- ExecutePendingJobsResult
- InterruptHandler
- JSCFunctionPointer
- JSContextPointer
- JSRuntimePointer
- JSValue
- JSValueConst
- JSValueConstPointer
- JSValueConstPointerPointer
- JSValuePointer
- JSValuePointerPointer
- Pointer
- QTS_C_To_HostCallbackFuncPointer
- QTS_C_To_HostInterruptFuncPointer
- QuickJSHandle
- QuickJSPropertyKey
- StaticJSValue
- SuccessOrFail
- VmCallResult
- VmFunctionImplementation
Ƭ ExecutePendingJobsResult: SuccessOrFail‹number, QuickJSHandle›
Defined in quickjs.ts:212
Used as an optional for the results of executing pendingJobs.
On success, value
contains the number of async jobs executed
by the runtime.
{ value: number } | { error: QuickJSHandle }
.
Ƭ InterruptHandler: function
Defined in quickjs.ts:63
Callback called regularly while the VM executes code. Determines if a VM's execution should be interrupted.
returns
true
to interrupt JS execution inside the VM.
returns
false
or undefined
to continue JS execution inside the VM.
▸ (vm
: QuickJSVm): boolean | undefined
Parameters:
Name | Type |
---|---|
vm |
QuickJSVm |
Ƭ JSCFunctionPointer: Pointer‹"JSCFunction"›
Defined in ffi.ts:49
Used internally for C-to-Javascript function calls.
Ƭ JSContextPointer: Pointer‹"JSContext"›
Defined in ffi.ts:22
JSContext*
.
Ƭ JSRuntimePointer: Pointer‹"JSRuntime"›
Defined in ffi.ts:17
JSRuntime*
.
Ƭ JSValue: Lifetime‹JSValuePointer, JSValuePointer, QuickJSVm›
Defined in quickjs.ts:949
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, JSValuePointer, QuickJSVm›
Defined in quickjs.ts:932
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:34
`JSValueConst* See JSValueConst and StaticJSValue.
Ƭ JSValueConstPointerPointer: Pointer‹"JSValueConst[]"›
Defined in ffi.ts:44
Used internally for Javascript-to-C function calls.
Ƭ JSValuePointer: Pointer‹"JSValue"›
Defined in ffi.ts:28
JSValue*
.
See JSValue.
Ƭ JSValuePointerPointer: Pointer‹"JSValue[]"›
Defined in ffi.ts:39
Used internally for Javascript-to-C function calls.
Ƭ Pointer: number & object
Defined in ffi.ts:12
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:54
Used internally for C-to-Javascript function calls.
Ƭ QTS_C_To_HostInterruptFuncPointer: Pointer‹"C_To_HostInterruptFunc"›
Defined in ffi.ts:59
Used internally for C-to-Javascript interrupt handlers.
Ƭ QuickJSHandle: StaticJSValue | JSValue | JSValueConst
Defined in quickjs.ts:958
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.
Ƭ QuickJSPropertyKey: number | string | QuickJSHandle
Defined in quickjs.ts:65
Ƭ StaticJSValue: Lifetime‹JSValueConstPointer, JSValueConstPointer, QuickJSVm›
Defined in quickjs.ts:920
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:1164
This is the top-level entrypoint for the quickjs-emscripten library. Get the root QuickJS API.
Returns: Promise‹QuickJS›
▸ getQuickJSSync(): QuickJS
Defined in quickjs.ts:1177
Provides synchronous access to the QuickJS API once getQuickJS has resolved at least once.
throws
If called before getQuickJS
resolves.
Returns: QuickJS
▸ shouldInterruptAfterDeadline(deadline
: Date | number): InterruptHandler
Defined in quickjs.ts:1150
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: InterruptHandler