go.ketch.com/lib/goja_nodejs@v0.0.1/README.md (about) 1 Nodejs compatibility library for Goja 2 ==== 3 4 This is a collection of Goja modules that provide nodejs compatibility. 5 6 Example: 7 8 ```go 9 package main 10 11 import ( 12 "go.ketch.com/lib/goja" 13 "go.ketch.com/lib/goja_nodejs/require" 14 ) 15 16 func main() { 17 registry := new(require.Registry) // this can be shared by multiple runtimes 18 19 runtime := goja.New() 20 req := registry.Enable(runtime) 21 22 runtime.RunString(` 23 var m = require("m.js"); 24 m.test(); 25 `) 26 27 m, err := req.Require("m.js") 28 _, _ = m, err 29 } 30 ``` 31 32 More modules will be added. Contributions welcome too.