|
||
---|---|---|
.. | ||
buffer | ||
console | ||
errors | ||
eventloop | ||
process | ||
require | ||
url | ||
util | ||
assert.js | ||
LICENSE | ||
README.md | ||
staticcheck.conf |
Nodejs compatibility library for Goja
This is a collection of Goja modules that provide nodejs compatibility.
Example:
package main
import (
"apigo.cc/ai/ai/goja"
"apigo.cc/ai/ai/goja_nodejs/require"
)
func main() {
registry := new(require.Registry) // this can be shared by multiple runtimes
runtime := goja.New()
req := registry.Enable(runtime)
runtime.RunString(`
var m = require("./m.js");
m.test();
`)
m, err := req.Require("./m.js")
_, _ = m, err
}
More modules will be added. Contributions welcome too.