Skip to content

Latest commit

 

History

History
163 lines (91 loc) · 4.87 KB

QuickJSAsyncWASMModule.md

File metadata and controls

163 lines (91 loc) · 4.87 KB

quickjs-emscriptenquickjs-emscripten-coreReadme | Exports


quickjs-emscripten / quickjs-emscripten-core / QuickJSAsyncWASMModule

Class: QuickJSAsyncWASMModule

Asyncified version of QuickJSWASMModule.

Due to limitations of Emscripten's ASYNCIFY process, only a single async function call can happen at a time across the entire WebAssembly module.

That means that all runtimes, contexts, functions, etc created inside this WebAssembly are limited to a single concurrent async action. Multiple concurrent async actions is an error.

To allow for multiple concurrent async actions, you must create multiple WebAssembly modules.

Contents

Extends

Methods

evalCode()

evalCode(): never

Synchronous evalCode is not supported.

Returns

never

Overrides

quickjs-emscripten-core.QuickJSWASMModule.evalCode

Source

packages/quickjs-emscripten-core/src/module-asyncify.ts:76


evalCodeAsync()

evalCodeAsync(code, options): Promise<unknown>

One-off evaluate code without needing to create a QuickJSAsyncRuntime or QuickJSAsyncContext explicitly.

This version allows for asynchronous Ecmascript module loading.

Note that only a single async action can occur at a time inside the entire WebAssembly module. Multiple concurrent async actions is an error.

See the documentation for QuickJSWASMModule#evalCode for more details.

Parameters

code: string

options: ModuleEvalOptions

Returns

Promise<unknown>

Source

packages/quickjs-emscripten-core/src/module-asyncify.ts:91


getWasmMemory()

getWasmMemory(): Memory

Retrieve the WebAssembly memory used by this QuickJS module. Use this access very carefully - you are responsible for safe interaction with the memory.

To supply a custom, pre-initialized memory to QuickJS, create a new variant and provide the CustomizeVariantOptions#wasmMemory option.

Returns

Memory

Inherited from

quickjs-emscripten-core.QuickJSWASMModule.getWasmMemory

Source

packages/quickjs-emscripten-core/src/module.ts:426


newContext()

newContext(options): QuickJSAsyncContext

A simplified API to create a new QuickJSAsyncRuntime and a QuickJSAsyncContext inside that runtime at the same time. The runtime will be disposed when the context is disposed.

Parameters

options: ContextOptions= {}

Returns

QuickJSAsyncContext

Overrides

quickjs-emscripten-core.QuickJSWASMModule.newContext

Source

packages/quickjs-emscripten-core/src/module-asyncify.ts:67


newRuntime()

newRuntime(options): QuickJSAsyncRuntime

Create a new async runtime inside this WebAssembly module. All runtimes inside a module are limited to a single async call at a time. For multiple concurrent async actions, create multiple WebAssembly modules.

Parameters

options: AsyncRuntimeOptions= {}

Returns

QuickJSAsyncRuntime

Overrides

quickjs-emscripten-core.QuickJSWASMModule.newRuntime

Source

packages/quickjs-emscripten-core/src/module-asyncify.ts:41


Generated using typedoc-plugin-markdown and TypeDoc