jsmod/README.md

29 lines
688 B
Markdown

# go/jsmod
`jsmod` is the unified registry for JS modules and Go-JS runtime bridging configurations.
## API Reference
### `Register`
Registers a Go module exports map to JS.
```go
func Register(name string, exports map[string]any, unsafeList ...string)
```
### `GetModules`
Returns all registered modules.
```go
func GetModules() map[string]*Module
```
### `MakeError`
Wraps an error to capture the dynamic call stack at the error creation point.
```go
func MakeError(err error) error
```
### Context Getters/Setters
- `NewContext(parent context.Context, injects map[string]any) context.Context`
- `Get(ctx context.Context, key string) any`
- `IsSafeMode(ctx context.Context) bool`