jsmod/README.md

688 B

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.

func Register(name string, exports map[string]any, unsafeList ...string)

GetModules

Returns all registered modules.

func GetModules() map[string]*Module

MakeError

Wraps an error to capture the dynamic call stack at the error creation point.

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