Skip to content

Latest commit

 

History

History
136 lines (77 loc) · 3.94 KB

EmscriptenModuleLoaderOptions.md

File metadata and controls

136 lines (77 loc) · 3.94 KB

quickjs-emscriptenquickjs-emscripten-coreReadme | Exports


quickjs-emscripten / quickjs-emscripten-core / EmscriptenModuleLoaderOptions

Interface: EmscriptenModuleLoaderOptions

This structure is defined by Emscripten. It's possible to provide these parameters to an emscripten module loader. See the Emscripten Module API reference.

Contents

Extended By

Properties

wasmBinary?

wasmBinary?: ArrayBuffer

Compile this to WebAssembly.Module

Source

packages/quickjs-ffi-types/src/emscripten-types.ts:104


wasmMemory?

wasmMemory?: Memory

If provided, use this WebAssembly.Memory instead of an automatically created one.

Source

packages/quickjs-ffi-types/src/emscripten-types.ts:107

Methods

instantiateWasm()?

optional instantiateWasm(imports, onSuccess): Exports | Promise<Exports>

Create an instance of the WASM module, call onSuccess(instance), then return instance.exports

Parameters

imports: Imports

onSuccess: (instance) => void

Returns

Exports | Promise<Exports>

Source

packages/quickjs-ffi-types/src/emscripten-types.ts:110


locateFile()?

optional locateFile(fileName, prefix): string

If set, this method will be called when the runtime needs to load a file, such as a .wasm WebAssembly file, .mem memory init file, or a file generated by the file packager.

The function receives two parameters:

  • fileName, the relative path to the file as configured in build process, eg "emscripten-module.wasm".
  • prefix (path to the main JavaScript file’s directory). This may be '' (empty string) in some cases if the Emscripten Javascript code can't locate itself. Try logging it in your environment.

It should return the actual URI or path to the requested file.

This lets you host file packages on a different location than the directory of the JavaScript file (which is the default expectation), for example if you want to host them on a CDN.

Parameters

fileName: string

prefix: string

Often '' (empty string)

Returns

string

Source

packages/quickjs-ffi-types/src/emscripten-types.ts:97


monitorRunDependencies()?

optional monitorRunDependencies(left): void

Called by emscripten as dependencies blocking initialization are added or fulfilled. May only be called in debug builds.

Parameters

left: number

Returns

void

Source

packages/quickjs-ffi-types/src/emscripten-types.ts:116


Generated using typedoc-plugin-markdown and TypeDoc