Compare commits
No commits in common. "main" and "v1.0.0" have entirely different histories.
18
jsmod.go
18
jsmod.go
@ -1,22 +1,6 @@
|
|||||||
package jsmod
|
package jsmod
|
||||||
|
|
||||||
import (
|
import "sync"
|
||||||
"context"
|
|
||||||
"sync"
|
|
||||||
)
|
|
||||||
|
|
||||||
type contextKey string
|
|
||||||
|
|
||||||
const SafeModeKey contextKey = "SafeMode"
|
|
||||||
|
|
||||||
// IsSafeMode checks if the provided context indicates that the execution is in safe mode.
|
|
||||||
func IsSafeMode(ctx context.Context) bool {
|
|
||||||
v := ctx.Value(SafeModeKey)
|
|
||||||
if sm, ok := v.(bool); ok {
|
|
||||||
return sm
|
|
||||||
}
|
|
||||||
return false // Default to false if not specified (internal trusted caller)
|
|
||||||
}
|
|
||||||
|
|
||||||
type Module struct {
|
type Module struct {
|
||||||
Exports map[string]any
|
Exports map[string]any
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user