Interface: QuickJSEmscriptenModule
February 16, 2026 · View on GitHub
quickjs-emscripten / quickjs-emscripten-core / QuickJSEmscriptenModule
Interface: QuickJSEmscriptenModule
Defined in: packages/quickjs-ffi-types/src/emscripten-types.ts:242
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:244
FAST_MEMORY
FAST_MEMORY:
number
Defined in: packages/quickjs-ffi-types/src/emscripten-types.ts:169
Inherited from
HEAP16
HEAP16:
Int16Array
Defined in: packages/quickjs-ffi-types/src/emscripten-types.ts:159
Inherited from
HEAP32
HEAP32:
Int32Array
Defined in: packages/quickjs-ffi-types/src/emscripten-types.ts:160
Inherited from
HEAP8
HEAP8:
Int8Array
Defined in: packages/quickjs-ffi-types/src/emscripten-types.ts:158
Inherited from
HEAPF32
HEAPF32:
Float32Array
Defined in: packages/quickjs-ffi-types/src/emscripten-types.ts:164
Inherited from
HEAPF64
HEAPF64:
Float64Array
Defined in: packages/quickjs-ffi-types/src/emscripten-types.ts:165
Inherited from
HEAPU16
HEAPU16:
Uint16Array
Defined in: packages/quickjs-ffi-types/src/emscripten-types.ts:162
Inherited from
HEAPU32
HEAPU32:
Uint32Array
Defined in: packages/quickjs-ffi-types/src/emscripten-types.ts:163
Inherited from
HEAPU8
HEAPU8:
Uint8Array
Defined in: packages/quickjs-ffi-types/src/emscripten-types.ts:161
Inherited from
TOTAL_MEMORY
TOTAL_MEMORY:
number
Defined in: packages/quickjs-ffi-types/src/emscripten-types.ts:168
Inherited from
TOTAL_STACK
TOTAL_STACK:
number
Defined in: packages/quickjs-ffi-types/src/emscripten-types.ts:167
Inherited from
type
type:
"sync"
Defined in: packages/quickjs-ffi-types/src/emscripten-types.ts:243
wasmBinary?
optionalwasmBinary:ArrayBuffer
Defined in: packages/quickjs-ffi-types/src/emscripten-types.ts:105
Compile this to WebAssembly.Module
Inherited from
wasmMemory?
optionalwasmMemory: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
Methods
_free()
_free(
ptr):void
Defined in: packages/quickjs-ffi-types/src/emscripten-types.ts:149
Parameters
ptr
number
Returns
void
Inherited from
_malloc()
_malloc(
size):number
Defined in: packages/quickjs-ffi-types/src/emscripten-types.ts:148
Parameters
size
number
Returns
number
Inherited from
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
instantiateWasm()?
optionalinstantiateWasm(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()?
optionallocateFile(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
monitorRunDependencies()?
optionalmonitorRunDependencies(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
maxBytesToRead?
number
Returns
void
Inherited from
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
maxBytesToRead?
number
Returns
string