Skip to content

Nodejs compatibility library for Goja

License

Notifications You must be signed in to change notification settings

link-duan/goja_nodejs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Nodejs compatibility library for Goja

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 97.5%
  • JavaScript 2.5%