Interface: EmscriptenModuleLoaderOptions

February 16, 2026 · View on GitHub

quickjs-emscripten


quickjs-emscripten / quickjs-emscripten-core / EmscriptenModuleLoaderOptions

Interface: EmscriptenModuleLoaderOptions

Defined in: packages/quickjs-ffi-types/src/emscripten-types.ts:78

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?

optional wasmBinary: ArrayBuffer

Defined in: packages/quickjs-ffi-types/src/emscripten-types.ts:105

Compile this to WebAssembly.Module


wasmMemory?

optional wasmMemory: Memory

Defined in: packages/quickjs-ffi-types/src/emscripten-types.ts:108

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

Methods

instantiateWasm()?

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

Defined in: packages/quickjs-ffi-types/src/emscripten-types.ts:111

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

Parameters

imports

WebAssembly.Imports

onSuccess

(instance) => void

Returns

Exports | Promise<Exports>


locateFile()?

optional locateFile(fileName, prefix): string

Defined in: packages/quickjs-ffi-types/src/emscripten-types.ts:98

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


monitorRunDependencies()?

optional monitorRunDependencies(left): void

Defined in: packages/quickjs-ffi-types/src/emscripten-types.ts:117

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

Parameters

left

number

Returns

void