Skip to content

JavaScript virtual machine inside Golang (using V8)

License

Notifications You must be signed in to change notification settings

mtrempoltsev/gojs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go js

JavaScript virtual machine inside Golang (using V8)

Example of usage:

js, err := gojs.New(1) // use 1 thread
if err != nil {
    fmt.Println(err)
    return
}

defer js.Dispose()

err = js.Compile("my.js", "2 + 2")
if err != nil {
    fmt.Println(err)
    return
}

res, err := js.Run("my.js")
if err != nil {
    fmt.Println(err)
    return
}

defer res.Dispose()

val, err := res.ToInt()
if err != nil {
    fmt.Println(err)
    return
}

fmt.Printf("%T, %d\n", val, val) // int64, 4

About

JavaScript virtual machine inside Golang (using V8)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published