Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
147579b0d1 |
18
jsmod.go
18
jsmod.go
@ -1,6 +1,22 @@
|
||||
package jsmod
|
||||
|
||||
import "sync"
|
||||
import (
|
||||
"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 {
|
||||
Exports map[string]any
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user