Skip to content
forked from elsaland/quickjs

Go bindings to QuickJS: a fast, small, and embeddable ES2020 JavaScript interpreter.

License

Notifications You must be signed in to change notification settings

newdash/quickjs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

79 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

quickjs

github ci

Go bindings to QuickJS: a fast, small, and embeddable ES2020 JavaScript interpreter.

These bindings are a WIP and do not match full parity with QuickJS' API, though expose just enough features to be usable. The version of QuickJS that these bindings bind to may be located here.

NOTICE

QuickJS is not works well with Golang's goroutine, please DO NOT share a quickjs.Runtime cross different goroutines.

Usage

$ go get github.com/newdash/quickjs

Guidelines

  1. Free quickjs.Runtime and quickjs.Context once you are done using them.
  2. Free quickjs.Value's returned by Eval() and EvalFile(). All other values do not need to be freed, as they get garbage-collected.
  3. You may access the stacktrace of an error returned by Eval() or EvalFile() by casting it to a *quickjs.Error.
  4. Make new copies of arguments should you want to return them in functions you created.
  5. Make sure to call runtime.LockOSThread() to ensure that QuickJS always operates in the exact same thread.

Free

Free Safe Functions

  1. Value.Interface - inner references will be freed
  2. Value.InterfaceAndFree - current & inner reference will be freed
  3. Value.GetString(ByUint32) - new reference will be freed
  4. Value.GetInt64(ByUint32) - new reference will be freed
  5. Value.GetFloat64(ByUint32) - new reference will be freed
  6. Value.DynamicCall(WithContext) - args references will freed

License

QuickJS is released under the MIT license.

QuickJS bindings are copyright Kenta Iwasaki, with code copyright Fabrice Bellard and Charlie Gordon.

About

Go bindings to QuickJS: a fast, small, and embeddable ES2020 JavaScript interpreter.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 97.5%
  • Go 2.1%
  • C++ 0.4%