quickjs-emscripten • quickjs-emscripten • Readme | Exports
quickjs-emscripten / quickjs-emscripten
- Namespaces
- Classes
- Interfaces
- Type Aliases
- AsyncFunctionImplementation
- BorrowedHeapCharPointer
- EitherFFI
- EitherModule
- ExecutePendingJobsResult
- InterruptHandler
- Intrinsics
- JSBorrowedCharPointer
- JSContextPointer
- JSContextPointerPointer
- JSModuleDefPointer
- JSModuleLoadFailure
- JSModuleLoadResult
- JSModuleLoadSuccess
- JSModuleNormalizeFailure
- JSModuleNormalizeResult
- JSModuleNormalizeSuccess
- JSPromiseState
- JSPromiseStateEnum
- JSRuntimePointer
- JSValue
- JSValueConst
- JSValueConstPointer
- JSValueConstPointerPointer
- JSValuePointer
- JSValuePointerPointer
- JSVoidPointer
- OrLoader<T>
- OwnedHeapCharPointer
- PromiseExecutor<ResolveT, RejectT>
- PromisedDefault<T>
- QTS_C_To_HostCallbackFuncPointer
- QTS_C_To_HostInterruptFuncPointer
- QTS_C_To_HostLoadModuleFuncPointer
- QuickJSHandle
- QuickJSPropertyKey
- QuickJSVariant
- StaticJSValue
- SuccessOrFail<S, F>
- VmCallResult<VmHandle>
- VmFunctionImplementation<VmHandle>
- Variables
- Functions
- Lifetime
- QuickJSAsyncContext
- QuickJSAsyncRuntime
- QuickJSAsyncWASMModule
- QuickJSContext
- QuickJSDeferredPromise
- QuickJSRuntime
- QuickJSWASMModule
- Scope
- StaticLifetime
- TestQuickJSWASMModule
- UsingDisposable
- WeakLifetime
- AsyncRuntimeOptions
- ContextEvalOptions
- ContextOptions
- CustomizeVariantOptions
- Disposable
- EmscriptenModule
- EmscriptenModuleLoader
- EmscriptenModuleLoaderOptions
- JSModuleLoader
- JSModuleLoaderAsync
- JSModuleNormalizer
- JSModuleNormalizerAsync
- JSPromiseStateFulfilled
- JSPromiseStatePending
- JSPromiseStateRejected
- LowLevelJavascriptVm
- ModuleEvalOptions
- QuickJSAsyncEmscriptenModule
- QuickJSAsyncFFI
- QuickJSAsyncVariant
- QuickJSEmscriptenModule
- QuickJSFFI
- QuickJSSyncVariant
- RuntimeOptions
- RuntimeOptionsBase
- SourceMapData
- VmPropertyDescriptor
AsyncFunctionImplementation: (
this
, ...args
) =>Promise
<QuickJSHandle
|VmCallResult
<QuickJSHandle
> |void
>
• this: QuickJSHandle
• ...args: QuickJSHandle
[]
Promise
<QuickJSHandle
| VmCallResult
<QuickJSHandle
> | void
>
packages/quickjs-emscripten-core/dist/index.d.ts:313
BorrowedHeapCharPointer:
Pointer
<"const char"
|"char"
|"js const char"
>
Used internally for Javascript-to-C calls that may contain strings too large for the Emscripten stack.
packages/quickjs-ffi-types/dist/index.d.ts:66
EitherFFI:
QuickJSFFI
|QuickJSAsyncFFI
packages/quickjs-ffi-types/dist/index.d.ts:496
EitherModule:
QuickJSEmscriptenModule
|QuickJSAsyncEmscriptenModule
packages/quickjs-ffi-types/dist/index.d.ts:304
ExecutePendingJobsResult:
SuccessOrFail
<number
,QuickJSHandle
&Object
>
Used as an optional for the results of executing pendingJobs.
On success, value
contains the number of async jobs executed
by the runtime.
packages/quickjs-emscripten-core/dist/index.d.ts:122
InterruptHandler: (
runtime
) =>boolean
|undefined
Callback called regularly while the VM executes code. Determines if a VM's execution should be interrupted.
• runtime: QuickJSRuntime
boolean
| undefined
true
to interrupt JS execution inside the VM.
false
or undefined
to continue JS execution inside the VM.
packages/quickjs-emscripten-core/dist/index.d.ts:115
Intrinsics:
Object
Language features that can be enabled or disabled in a QuickJSContext.
BaseObjects?:
boolean
BigDecimal?:
boolean
BigFloat?:
boolean
BigInt?:
boolean
BignumExt?:
boolean
Date?:
boolean
Eval?:
boolean
JSON?:
boolean
MapSet?:
boolean
OperatorOverloading?:
boolean
Promise?:
boolean
Proxy?:
boolean
RegExp?:
boolean
RegExpCompiler?:
boolean
StringNormalize?:
boolean
TypedArrays?:
boolean
packages/quickjs-emscripten-core/dist/index.d.ts:443
JSBorrowedCharPointer:
Pointer
<"js const char"
>
Used internally for Javascript-to-C calls that may contain strings too large for the Emscripten stack.
packages/quickjs-ffi-types/dist/index.d.ts:76
JSContextPointer:
Pointer
<"JSContext"
>
JSContext*
.
packages/quickjs-ffi-types/dist/index.d.ts:20
JSContextPointerPointer:
Pointer
<"JSContext"
>
JSContext**
. Used internally for execute pending jobs.
packages/quickjs-ffi-types/dist/index.d.ts:24
JSModuleDefPointer:
Pointer
<"JSModuleDef"
>
JSModuleDef*
.
packages/quickjs-ffi-types/dist/index.d.ts:28
JSModuleLoadFailure:
Error
|QuickJSHandle
packages/quickjs-emscripten-core/dist/index.d.ts:394
JSModuleLoadResult:
JSModuleLoadSuccess
|SuccessOrFail
<JSModuleLoadSuccess
,JSModuleLoadFailure
>
packages/quickjs-emscripten-core/dist/index.d.ts:395
JSModuleLoadSuccess:
string
packages/quickjs-emscripten-core/dist/index.d.ts:393
JSModuleNormalizeFailure:
Error
|QuickJSHandle
packages/quickjs-emscripten-core/dist/index.d.ts:405
JSModuleNormalizeResult:
JSModuleNormalizeSuccess
|SuccessOrFail
<JSModuleNormalizeSuccess
,JSModuleNormalizeFailure
>
packages/quickjs-emscripten-core/dist/index.d.ts:406
JSModuleNormalizeSuccess:
string
packages/quickjs-emscripten-core/dist/index.d.ts:404
JSPromiseState:
JSPromiseStatePending
|JSPromiseStateFulfilled
|JSPromiseStateRejected
A promise state inside QuickJS, which can be pending, fulfilled, or rejected. You can unwrap a JSPromiseState with QuickJSContext#unwrapResult.
packages/quickjs-emscripten-core/dist/index.d.ts:673
JSPromiseStateEnum:
Brand
<typeofJSPromiseStateEnum
[keyof typeofJSPromiseStateEnum
],"JSPromiseStateEnum"
>
State of a promise.
packages/quickjs-ffi-types/dist/index.d.ts:140
JSRuntimePointer:
Pointer
<"JSRuntime"
>
JSRuntime*
.
packages/quickjs-ffi-types/dist/index.d.ts:16
JSValue:
Lifetime
<JSValuePointer
,JSValuePointer
,QuickJSRuntime
>
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.
packages/quickjs-emscripten-core/dist/index.d.ts:384
JSValueConst:
Lifetime
<JSValueConstPointer
,JSValuePointer
,QuickJSRuntime
>
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.
packages/quickjs-emscripten-core/dist/index.d.ts:368
JSValueConstPointer:
Pointer
<"JSValueConst"
>
`JSValueConst* See JSValueConst and StaticJSValue.
packages/quickjs-ffi-types/dist/index.d.ts:38
JSValueConstPointerPointer:
Pointer
<"JSValueConst[]"
>
Used internally for Javascript-to-C function calls.
packages/quickjs-ffi-types/dist/index.d.ts:46
JSValuePointer:
Pointer
<"JSValue"
>
JSValue*
.
See JSValue.
packages/quickjs-ffi-types/dist/index.d.ts:33
JSValuePointerPointer:
Pointer
<"JSValue[]"
>
Used internally for Javascript-to-C function calls.
packages/quickjs-ffi-types/dist/index.d.ts:42
JSVoidPointer:
Pointer
<any
>
Opaque pointer that was allocated by js_malloc.
packages/quickjs-ffi-types/dist/index.d.ts:80
OrLoader<
T
>:T
| () =>Promise
<T
>
• T
packages/quickjs-emscripten-core/dist/index.d.ts:1532
OwnedHeapCharPointer:
Pointer
<"char"
>
Used internally for Javascript-to-C calls that may contain strings too large for the Emscripten stack.
packages/quickjs-ffi-types/dist/index.d.ts:71
PromiseExecutor<
ResolveT
,RejectT
>: (resolve
,reject
) =>void
• ResolveT
• RejectT
• resolve: (value
) => void
• reject: (reason
) => void
void
packages/quickjs-emscripten-core/dist/index.d.ts:531
PromisedDefault<
T
>:T
|Promise
<T
> |Promise
<Object
> |Promise
<Object
>
• T
packages/quickjs-emscripten-core/dist/index.d.ts:1473
QTS_C_To_HostCallbackFuncPointer:
Pointer
<"C_To_HostCallbackFunc"
>
Used internally for C-to-Javascript function calls.
packages/quickjs-ffi-types/dist/index.d.ts:53
QTS_C_To_HostInterruptFuncPointer:
Pointer
<"C_To_HostInterruptFunc"
>
Used internally for C-to-Javascript interrupt handlers.
packages/quickjs-ffi-types/dist/index.d.ts:57
QTS_C_To_HostLoadModuleFuncPointer:
Pointer
<"C_To_HostLoadModuleFunc"
>
Used internally for C-to-Javascript module loading.
packages/quickjs-ffi-types/dist/index.d.ts:61
QuickJSHandle:
StaticJSValue
|JSValue
|JSValueConst
Wraps a C pointer to a QuickJS JSValue, which represents a Javascript value inside a QuickJS virtual machine.
Values must not be shared between QuickJSContext instances.
You must dispose of any handles you create by calling the .dispose()
method.
packages/quickjs-emscripten-core/dist/index.d.ts:392
QuickJSPropertyKey:
number
|string
|QuickJSHandle
Property key for getting or setting a property on a handle with QuickJSContext#getProp, QuickJSContext#setProp, or QuickJSContext#defineProp.
packages/quickjs-emscripten-core/dist/index.d.ts:779
QuickJSVariant:
QuickJSSyncVariant
|QuickJSAsyncVariant
packages/quickjs-ffi-types/dist/index.d.ts:495
StaticJSValue:
Lifetime
<JSValueConstPointer
,JSValueConstPointer
,QuickJSRuntime
>
A QuickJSHandle to a constant that will never change, and does not need to be disposed.
packages/quickjs-emscripten-core/dist/index.d.ts:357
SuccessOrFail<
S
,F
>:Object
|Object
Used as an optional.
{ value: S } | { error: E }
.
• S
• F
packages/quickjs-emscripten-core/dist/index.d.ts:17
VmCallResult<
VmHandle
>:SuccessOrFail
<VmHandle
,VmHandle
>
Used as an optional for results of a Vm call.
{ value: VmHandle } | { error: VmHandle }
.
• VmHandle
packages/quickjs-emscripten-core/dist/index.d.ts:33
VmFunctionImplementation<
VmHandle
>: (this
, ...args
) =>VmHandle
|VmCallResult
<VmHandle
> |void
• VmHandle
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
packages/quickjs-emscripten-core/dist/index.d.ts:46
const
DEBUG_ASYNC:QuickJSAsyncVariant
Docs | Variant with separate .WASM file. Supports browser ESM, NodeJS ESM, and NodeJS CommonJS.
Variable | Setting | Description |
---|---|---|
library | quickjs | The original bellard/quickjs library. Version 2024-02-14+36911f0d vendored to quickjs-emscripten on 2024-06-15. |
releaseMode | debug | Enables assertions and memory sanitizers. Try to run your tests against debug variants, in addition to your preferred production variant, to catch more bugs. |
syncMode | asyncify | Build run through the ASYNCIFY WebAssembly transform. This imposes substantial size (2x the size of sync) and speed penalties (40% the speed of sync). In return, allows synchronous calls from the QuickJS WASM runtime to async functions on the host. The extra magic makes this variant slower than sync variants. Note that both variants support regular async functions. Only adopt ASYNCIFY if you need to! The QuickJSAsyncRuntime and QuickJSAsyncContext classes expose the ASYNCIFY-specific APIs. |
emscriptenInclusion | wasm | Has a separate .wasm file. May offer better caching in your browser, and reduces the size of your JS bundle. If you have issues, try a 'singlefile' variant. |
exports | require import browser workerd | Has these package.json export conditions |
packages/variant-quickjs-wasmfile-debug-asyncify/dist/index.d.ts:18
const
DEBUG_SYNC:QuickJSSyncVariant
Docs | Variant with separate .WASM file. Supports browser ESM, NodeJS ESM, and NodeJS CommonJS.
Variable | Setting | Description |
---|---|---|
library | quickjs | The original bellard/quickjs library. Version 2024-02-14+36911f0d vendored to quickjs-emscripten on 2024-06-15. |
releaseMode | debug | Enables assertions and memory sanitizers. Try to run your tests against debug variants, in addition to your preferred production variant, to catch more bugs. |
syncMode | sync | The default, normal build. Note that both variants support regular async functions. |
emscriptenInclusion | wasm | Has a separate .wasm file. May offer better caching in your browser, and reduces the size of your JS bundle. If you have issues, try a 'singlefile' variant. |
exports | require import browser workerd | Has these package.json export conditions |
packages/variant-quickjs-wasmfile-debug-sync/dist/index.d.ts:18
const
DefaultIntrinsics:Readonly
<Object
>
The default Intrinsics language features enabled in a QuickJSContext.
readonly
BaseObjects:true
readonly
Date:true
readonly
Eval:true
readonly
JSON:true
readonly
MapSet:true
readonly
Promise:true
readonly
Proxy:true
readonly
RegExp:true
readonly
StringNormalize:true
readonly
TypedArrays:true
packages/quickjs-emscripten-core/dist/index.d.ts:465
EvalFlags:
Object
Bitfield options for JS_Eval() C function.
readonly
JS_EVAL_FLAG_BACKTRACE_BARRIER:number
don't include the stack frames before this eval in the Error() backtraces
readonly
JS_EVAL_FLAG_COMPILE_ONLY:number
compile but do not run. The result is an object with a JS_TAG_FUNCTION_BYTECODE or JS_TAG_MODULE tag. It can be executed with JS_EvalFunction().
readonly
JS_EVAL_FLAG_STRICT:number
force 'strict' mode
readonly
JS_EVAL_FLAG_STRIP:number
force 'strip' mode
readonly
JS_EVAL_TYPE_DIRECT:number
direct call (internal use)
readonly
JS_EVAL_TYPE_GLOBAL:number
global code (default)
readonly
JS_EVAL_TYPE_INDIRECT:number
indirect call (internal use)
readonly
JS_EVAL_TYPE_MASK:number
readonly
JS_EVAL_TYPE_MODULE:number
module code
packages/quickjs-ffi-types/dist/index.d.ts:89
IntrinsicsFlags:
Object
Bitfield options for QTS_NewContext intrinsices
readonly
BaseObjects:number
readonly
BigDecimal:number
readonly
BigFloat:number
readonly
BigInt:number
readonly
BignumExt:number
readonly
Date:number
readonly
Eval:number
readonly
JSON:number
readonly
MapSet:number
readonly
OperatorOverloading:number
readonly
Promise:number
readonly
Proxy:number
readonly
RegExp:number
readonly
RegExpCompiler:number
readonly
StringNormalize:number
readonly
TypedArrays:number
packages/quickjs-ffi-types/dist/index.d.ts:117
JSPromiseStateEnum:
Object
readonly
Fulfilled:1
readonly
Pending:0
readonly
Rejected:2
packages/quickjs-ffi-types/dist/index.d.ts:140
const
RELEASE_ASYNC:QuickJSAsyncVariant
Docs | Variant with separate .WASM file. Supports browser ESM, NodeJS ESM, and NodeJS CommonJS.
Variable | Setting | Description |
---|---|---|
library | quickjs | The original bellard/quickjs library. Version 2024-02-14+36911f0d vendored to quickjs-emscripten on 2024-06-15. |
releaseMode | release | Optimized for performance; use when building/deploying your application. |
syncMode | asyncify | Build run through the ASYNCIFY WebAssembly transform. This imposes substantial size (2x the size of sync) and speed penalties (40% the speed of sync). In return, allows synchronous calls from the QuickJS WASM runtime to async functions on the host. The extra magic makes this variant slower than sync variants. Note that both variants support regular async functions. Only adopt ASYNCIFY if you need to! The QuickJSAsyncRuntime and QuickJSAsyncContext classes expose the ASYNCIFY-specific APIs. |
emscriptenInclusion | wasm | Has a separate .wasm file. May offer better caching in your browser, and reduces the size of your JS bundle. If you have issues, try a 'singlefile' variant. |
exports | require import browser workerd | Has these package.json export conditions |
packages/variant-quickjs-wasmfile-release-asyncify/dist/index.d.ts:18
const
RELEASE_SYNC:QuickJSSyncVariant
Docs | Variant with separate .WASM file. Supports browser ESM, NodeJS ESM, and NodeJS CommonJS.
Variable | Setting | Description |
---|---|---|
library | quickjs | The original bellard/quickjs library. Version 2024-02-14+36911f0d vendored to quickjs-emscripten on 2024-06-15. |
releaseMode | release | Optimized for performance; use when building/deploying your application. |
syncMode | sync | The default, normal build. Note that both variants support regular async functions. |
emscriptenInclusion | wasm | Has a separate .wasm file. May offer better caching in your browser, and reduces the size of your JS bundle. If you have issues, try a 'singlefile' variant. |
exports | require import browser workerd | Has these package.json export conditions |
packages/variant-quickjs-wasmfile-release-sync/dist/index.d.ts:18
assertSync<
Args
,R
>(fn
): (...args
) =>R
• Args extends any
[]
• R
• fn: (...args
) => R
Function
• ...args:
Args
R
packages/quickjs-ffi-types/dist/index.d.ts:85
getQuickJS():
Promise
<QuickJSWASMModule
>
Get a shared singleton QuickJSWASMModule. Use this to evaluate code or create Javascript environments.
This is the top-level entrypoint for the quickjs-emscripten library.
If you need strictest possible isolation guarantees, you may create a separate QuickJSWASMModule via newQuickJSWASMModule.
To work with the asyncified version of this library, see these functions:
Promise
<QuickJSWASMModule
>
packages/quickjs-emscripten/src/mod.ts:28
getQuickJSSync():
QuickJSWASMModule
Provides synchronous access to the shared QuickJSWASMModule instance returned by getQuickJS, as long as least once.
If called before getQuickJS
resolves.
packages/quickjs-emscripten/src/mod.ts:41
isFail<
S
,F
>(successOrFail
):successOrFail is Object
• S
• F
• successOrFail: SuccessOrFail
<S
, F
>
successOrFail is Object
packages/quickjs-emscripten-core/dist/index.d.ts:26
isSuccess<
S
,F
>(successOrFail
):successOrFail is Object
• S
• F
• successOrFail: SuccessOrFail
<S
, F
>
successOrFail is Object
packages/quickjs-emscripten-core/dist/index.d.ts:23
memoizePromiseFactory<
T
>(fn
): () =>Promise
<T
>
Helper intended to memoize the creation of a WebAssembly module.
const getDebugModule = memoizePromiseFactory(() => newQuickJSWASMModule(DEBUG_SYNC))
• T
• fn: () => Promise
<T
>
Function
Promise
<T
>
packages/quickjs-emscripten-core/dist/index.d.ts:1531
newAsyncContext(
options
?):Promise
<QuickJSAsyncContext
>
Create a new QuickJSAsyncContext (with an associated runtime) in an separate WebAssembly module.
Each context is isolated in a separate WebAssembly module, so that errors in one runtime cannot contaminate another runtime, and each runtime can execute an asynchronous action without conflicts.
Note that there is a hard limit on the number of WebAssembly modules in older versions of v8: https://bugs.chromium.org/p/v8/issues/detail?id=12076
• options?: ContextOptions
Promise
<QuickJSAsyncContext
>
packages/quickjs-emscripten/src/mod.ts:76
newAsyncRuntime(
options
?):Promise
<QuickJSAsyncRuntime
>
Create a new QuickJSAsyncRuntime in a separate WebAssembly module.
Each runtime is isolated in a separate WebAssembly module, so that errors in one runtime cannot contaminate another runtime, and each runtime can execute an asynchronous action without conflicts.
Note that there is a hard limit on the number of WebAssembly modules in older versions of v8: https://bugs.chromium.org/p/v8/issues/detail?id=12076
• options?: AsyncRuntimeOptions
Promise
<QuickJSAsyncRuntime
>
packages/quickjs-emscripten/src/mod.ts:59
newQuickJSAsyncWASMModule(
variantOrPromise
):Promise
<QuickJSAsyncWASMModule
>
Create a new, completely isolated WebAssembly module containing a version of the QuickJS library compiled with Emscripten's ASYNCIFY transform.
This version of the library offers features that enable synchronous code inside the VM to interact with asynchronous code in the host environment. See the documentation on QuickJSAsyncWASMModule, QuickJSAsyncRuntime, and QuickJSAsyncContext.
Note that there is a hard limit on the number of WebAssembly modules in older versions of v8: https://bugs.chromium.org/p/v8/issues/detail?id=12076
• variantOrPromise: PromisedDefault
<QuickJSAsyncVariant
>= RELEASE_ASYNC
Optionally, pass a QuickJSAsyncVariant to construct a different WebAssembly module.
Promise
<QuickJSAsyncWASMModule
>
packages/quickjs-emscripten/src/variants.ts:47
newQuickJSAsyncWASMModuleFromVariant(
variantOrPromise
):Promise
<QuickJSAsyncWASMModule
>
Create a new, completely isolated WebAssembly module containing a version of the QuickJS library compiled with Emscripten's ASYNCIFY transform.
This version of the library offers features that enable synchronous code inside the VM to interact with asynchronous code in the host environment. See the documentation on QuickJSAsyncWASMModule, QuickJSAsyncRuntime, and QuickJSAsyncContext.
Note that there is a hard limit on the number of WebAssembly modules in older versions of v8: https://bugs.chromium.org/p/v8/issues/detail?id=12076
• variantOrPromise: PromisedDefault
<QuickJSAsyncVariant
>
A QuickJSAsyncVariant to construct the WebAssembly module.
Promise
<QuickJSAsyncWASMModule
>
const quickjs = new newQuickJSAsyncWASMModuleFromVariant(
import('@jitl/quickjs-browser-debug-asyncify-wasm')
)
packages/quickjs-emscripten-core/dist/index.d.ts:1520
newQuickJSWASMModule(
variantOrPromise
):Promise
<QuickJSWASMModule
>
Create a new, completely isolated WebAssembly module containing the QuickJS library. See the documentation on QuickJSWASMModule.
Note that there is a hard limit on the number of WebAssembly modules in older versions of v8: https://bugs.chromium.org/p/v8/issues/detail?id=12076
• variantOrPromise: PromisedDefault
<QuickJSSyncVariant
>= RELEASE_SYNC
Optionally, pass a QuickJSSyncVariant to construct a different WebAssembly module.
Promise
<QuickJSWASMModule
>
packages/quickjs-emscripten/src/variants.ts:25
newQuickJSWASMModuleFromVariant(
variantOrPromise
):Promise
<QuickJSWASMModule
>
Create a new, completely isolated WebAssembly module containing the QuickJS library. See the documentation on QuickJSWASMModule.
Note that there is a hard limit on the number of WebAssembly modules in older versions of v8: https://bugs.chromium.org/p/v8/issues/detail?id=12076
• variantOrPromise: PromisedDefault
<QuickJSSyncVariant
>
A QuickJSSyncVariant to construct the WebAssembly module.
Promise
<QuickJSWASMModule
>
const quickjs = new newQuickJSWASMModuleFromVariant(
import('@jitl/quickjs-browser-release-sync-wasm')
)
packages/quickjs-emscripten-core/dist/index.d.ts:1495
newVariant<
T
>(baseVariant
,options
):T
Create a new variant by overriding how Emscripten obtains the WebAssembly module. This may be necessary in Cloudflare Workers, which can't compile WebAssembly modules from binary data.
• T extends QuickJSVariant
• baseVariant: T
• options: CustomizeVariantOptions
T
packages/quickjs-emscripten-core/dist/index.d.ts:1575
shouldInterruptAfterDeadline(
deadline
):InterruptHandler
Returns an interrupt handler that interrupts Javascript execution after a deadline time.
• deadline: number
| Date
Interrupt execution if it's still running after this time.
Number values are compared against Date.now()
packages/quickjs-emscripten-core/dist/index.d.ts:1583
Generated using typedoc-plugin-markdown and TypeDoc