Interface: QuickJSAsyncEmscriptenModule

February 16, 2026 · View on GitHub

quickjs-emscripten


quickjs-emscripten / quickjs-emscripten-core / QuickJSAsyncEmscriptenModule

Interface: QuickJSAsyncEmscriptenModule

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

Typings for the features we use to interface with our Emscripten build of QuickJS.

Contents

Extends

Properties

callbacks

callbacks: EmscriptenModuleCallbacks

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


FAST_MEMORY

FAST_MEMORY: number

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

Inherited from

EmscriptenModule.FAST_MEMORY


HEAP16

HEAP16: Int16Array

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

Inherited from

EmscriptenModule.HEAP16


HEAP32

HEAP32: Int32Array

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

Inherited from

EmscriptenModule.HEAP32


HEAP8

HEAP8: Int8Array

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

Inherited from

EmscriptenModule.HEAP8


HEAPF32

HEAPF32: Float32Array

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

Inherited from

EmscriptenModule.HEAPF32


HEAPF64

HEAPF64: Float64Array

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

Inherited from

EmscriptenModule.HEAPF64


HEAPU16

HEAPU16: Uint16Array

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

Inherited from

EmscriptenModule.HEAPU16


HEAPU32

HEAPU32: Uint32Array

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

Inherited from

EmscriptenModule.HEAPU32


HEAPU8

HEAPU8: Uint8Array

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

Inherited from

EmscriptenModule.HEAPU8


TOTAL_MEMORY

TOTAL_MEMORY: number

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

Inherited from

EmscriptenModule.TOTAL_MEMORY


TOTAL_STACK

TOTAL_STACK: number

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

Inherited from

EmscriptenModule.TOTAL_STACK


type

type: "async"

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

Todo

Implement this field


wasmBinary?

optional wasmBinary: ArrayBuffer

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

Compile this to WebAssembly.Module

Inherited from

EmscriptenModule.wasmBinary


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.

Inherited from

EmscriptenModule.wasmMemory

Methods

_free()

_free(ptr): void

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

Parameters

ptr

number

Returns

void

Inherited from

EmscriptenModule._free


_malloc()

_malloc(size): number

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

Parameters

size

number

Returns

number

Inherited from

EmscriptenModule._malloc


cwrap()

cwrap(ident, returnType, argTypes, opts?): (...args) => any

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

Parameters

ident

string

returnType

ValueType | null

argTypes

ValueType[]

opts?

CCallOpts

Returns

(...args): any

Parameters
args

...any[]

Returns

any

Inherited from

EmscriptenModule.cwrap


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>

Inherited from

EmscriptenModule.instantiateWasm


lengthBytesUTF8()

lengthBytesUTF8(str): number

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

Parameters

str

string

Returns

number

Inherited from

EmscriptenModule.lengthBytesUTF8


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

Inherited from

EmscriptenModule.locateFile


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

Inherited from

EmscriptenModule.monitorRunDependencies


stringToUTF8()

stringToUTF8(str, outPtr, maxBytesToRead?): void

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

Write JS str to HeapChar pointer. https://emscripten.org/docs/api\_reference/preamble.js.html#stringToUTF8

Parameters

str

string

outPtr

OwnedHeapCharPointer

maxBytesToRead?

number

Returns

void

Inherited from

EmscriptenModule.stringToUTF8


UTF8ToString()

UTF8ToString(ptr, maxBytesToRead?): string

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

HeapChar to JS string. https://emscripten.org/docs/api\_reference/preamble.js.html#UTF8ToString

Parameters

ptr

BorrowedHeapCharPointer

maxBytesToRead?

number

Returns

string

Inherited from

EmscriptenModule.UTF8ToString