@jitl/quickjs-ffi-types
Advanced tools
Changelog
v0.31.0
quickjs-for-quickjs
, a package that can run inside quickjs, so you can put quickjs inside your quickjs.Changelog
v0.30.0
setDebugMode
context.getOwnPropertyNames(handle, options)
to iterate the key or array index handles.context.getLength(handle)
which reads handle.length
and returns it as a number or undefined to make writing for (i=0;i<length;i++)
loops easier.context.getIterator(handle)
calls handle[Symbol.iterator]()
and then exposes the result as an IterableIterator
to host javascript.SuccessOrFail<T, QuickJSHandle>
return type is largely replaced with a new return type DisposableSuccess<T> | DisposableFail<QuickJSHandle>
. The new type implements result.unwrap()
as a replacement for context.unwrapResult(result)
. It also implements dispose()
directly, so you no longer need to distinguish between success and failure to clean up.context.callMethod(handle, 'methodName')
, this makes it easier to call methods like context.callMethod(handle, 'keys')
or context.callMethod('values')
which can be used with the new iterator.context.eq(a, b)
, context.sameValue(a, b)
, context.sameValueZero(a, b)
Debug logging is now disabled by default, even when using a DEBUG variant. It can be enabled on a runtime-by-runtime basis with runtime.setDebugMode(boolean)
or context.runtime.setDebugMode(boolean)
, or globally using setDebugMode(boolean)
. As with before, you should use a DEBUG variant to see logs from the WebAssembly C code.
Changelog
v0.29.0
context.evalCode(code, filename, { type: "module" })
or when code
is detected to be a module: now returns a handle to the module's exports, or a promise handle that resolves to the module's exports.context.getPromiseState(handle)
which returns the state of a promise handle, and can be unwrapped with context.unwrapResult(promiseState)
.Changelog
v0.28.0
context.evalCode(...)
now returns a Promise object instead of undefined
.Changelog
v0.27.0
wasmMemory: WebAssembly.Memory
option for newVariant
, and mod.getWasmMemory()
method for QuickJS[Async]WASMModule
.using
statement.Symbol.for('Symbol.dispose')
if Symbol.dispose
isn't defined globally.Changelog
v0.26.0
quickjs-ng
variants. quickjs-ng is a fork of quickjs under active development. It implements more EcmaScript standards and removes some of quickjs's custom language features like BigFloat.using value = vm.unwrapResult(vm.evalCode("1+1"))
, the value will be automatically disposed when the scope exits.