Skip to content
Nodejs compatibility library for Goja
Branch: master
Clone or download
Pull request Compare This branch is even with dop251:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
console
eventloop
require
util
.gitignore
LICENSE
README.md

README.md

Nodejs compatibility library for Goja

This is a collection of Goja modules that provide nodejs compatibility.

Example:

package main

import (
    "github.com/dop251/goja"
    "github.com/dop251/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.

You can’t perform that action at this time.