- JSCFunctionPointer
- JSContextPointer
- JSRuntimePointer
- JSValue
- JSValueConst
- JSValueConstPointer
- JSValueConstPointerPointer
- JSValuePointer
- Pointer
- QTS_C_To_HostCallbackFuncPointer
- QTS_C_To_HostInterruptFuncPointer
- QuickJSHandle
- ShouldInterruptHandler
- StaticJSValue
- SuccessOrFail
- VmCallResult
- VmFunctionImplementation
Ƭ JSCFunctionPointer: Pointer‹"JSCFunction"›
Defined in ffi.ts:43
Used internally for C-to-Javascript function calls.
Ƭ JSContextPointer: Pointer‹"JSContext"›
Defined in ffi.ts:21
JSContext*
.
Ƭ JSRuntimePointer: Pointer‹"JSRuntime"›
Defined in ffi.ts:16
JSRuntime*
.
Ƭ JSValue: Lifetime‹JSValuePointer, QuickJSVm›
Defined in quickjs.ts:676
A owned QuickJSHandle that should be disposed or returned.
The QuickJS interpreter passes Javascript values between functions as
JSValue
structs that references some internal data. Because passing
structs cross the Empscripten FFI interfaces is bothersome, we use pointers
to these structs instead.
A JSValue reference is "owned" in its scope. before exiting the scope, it
should be freed, by calling JS_FreeValue(ctx, js_value)
) or returned from
the scope. We extend that contract - a JSValuePointer (JSValue*
) must also
be free
d.
You can do so from Javascript by calling the .dispose() method.
Ƭ JSValueConst: Lifetime‹JSValueConstPointer, QuickJSVm›
Defined in quickjs.ts:659
A QuickJSHandle to a borrowed value that does not need to be disposed.
In QuickJS, a JSValueConst is a "borrowed" reference that isn't owned by the
current scope. That means that the current scope should not JS_FreeValue
it, or retain a reference to it after the scope exits, because it may be
freed by its owner.
quickjs-emscripten takes care of disposing JSValueConst references.
Ƭ JSValueConstPointer: Pointer‹"JSValueConst"›
Defined in ffi.ts:33
`JSValueConst* See JSValueConst and StaticJSValue.
Ƭ JSValueConstPointerPointer: Pointer‹"JSValueConst[]"›
Defined in ffi.ts:38
Used internally for Javascript-to-C function calls.
Ƭ JSValuePointer: Pointer‹"JSValue"›
Defined in ffi.ts:27
JSValue*
.
See JSValue.
Ƭ Pointer: number & object
Defined in ffi.ts:11
C pointer to export type CType
. Pointer types are used internally for FFI, but
are not intended for external use.
unstable
This export type is considered private and may change.
Ƭ QTS_C_To_HostCallbackFuncPointer: Pointer‹"C_To_HostCallbackFunc"›
Defined in ffi.ts:48
Used internally for C-to-Javascript function calls.
Ƭ QTS_C_To_HostInterruptFuncPointer: Pointer‹"C_To_HostInterruptFunc"›
Defined in ffi.ts:53
Used internally for C-to-Javascript interrupt handlers.
Ƭ QuickJSHandle: StaticJSValue | JSValue | JSValueConst
Defined in quickjs.ts:685
Wraps a C pointer to a QuickJS JSValue, which represents a Javascript value inside a QuickJS virtual machine.
Values must not be shared between QuickJSVm instances.
You must dispose of any handles you create by calling the .dispose()
method.
Ƭ ShouldInterruptHandler: function
Defined in quickjs.ts:49
Determines if a VM's execution should be interrupted.
Return true
to interrupt JS execution.
Return false
or undefined
to continue JS execution.
▸ (vm
: QuickJSVm): boolean | undefined
Parameters:
Name | Type |
---|---|
vm |
QuickJSVm |
Ƭ StaticJSValue: StaticLifetime‹JSValueConstPointer›
Defined in quickjs.ts:647
A QuickJSHandle to a constant that will never change, and does not need to be disposed.
Ƭ SuccessOrFail: object | object
Defined in vm-interface.ts:5
Used as an optional.
{ value: S } | { error: E }
.
Ƭ VmCallResult: SuccessOrFail‹VmHandle, VmHandle›
Defined in vm-interface.ts:18
Used as an optional for results of a Vm call.
{ value: VmHandle } | { error: VmHandle }
.
Ƭ VmFunctionImplementation: function
Defined in vm-interface.ts:32
A VmFunctionImplementation takes handles as arguments. It should return a handle, or be void.
To indicate an exception, a VMs can throw either a handle (transferred
directly) or any other Javascript value (only the poperties name
and
message
will be transferred). Or, the VmFunctionImplementation may return
a VmCallResult's { error: handle }
error variant.
VmFunctionImplementation should not free its arguments or its return value. It should not retain a reference to its return value or thrown error.
▸ (this
: VmHandle, ...args
: VmHandle[]): VmHandle | VmCallResult‹VmHandle› | void
Parameters:
Name | Type |
---|---|
this |
VmHandle |
...args |
VmHandle[] |
▸ getQuickJS(): Promise‹QuickJS›
Defined in quickjs.ts:881
This is the top-level entrypoint for the quickjs-emscripten library. Get the root QuickJS API.
Returns: Promise‹QuickJS›
▸ shouldInterruptAfterDeadline(deadline
: Date | number): ShouldInterruptHandler
Defined in quickjs.ts:867
Returns an interrupt handler that interrupts Javascript execution after a deadline time.
Parameters:
Name | Type | Description |
---|---|---|
deadline |
Date | number | Interrupt execution if it's still running after this time. Number values are compared against Date.now() |
Returns: ShouldInterruptHandler