Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mtrempoltsev/gojs
JavaScript virtual machine inside Golang (using V8)
https://github.com/mtrempoltsev/gojs
golang scripting v8-javascript-engine
Last synced: 2 months ago
JSON representation
JavaScript virtual machine inside Golang (using V8)
- Host: GitHub
- URL: https://github.com/mtrempoltsev/gojs
- Owner: mtrempoltsev
- License: mit
- Created: 2020-01-26T17:16:11.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-02-22T21:14:19.000Z (almost 5 years ago)
- Last Synced: 2024-08-03T09:07:02.275Z (6 months ago)
- Topics: golang, scripting, v8-javascript-engine
- Language: Go
- Size: 34.2 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-github-star - gojs
README
# go js
JavaScript virtual machine inside Golang (using V8)Example of usage:
```go
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
```