Skip to content

EmscriptenModule

Defined in: packages/runtime/src/wasm/types.ts:261

An initialized Emscripten module instance (result of the MODULARIZE factory).

Only the fields that wasmExec and the TTY bridge touch are typed — the full Emscripten module surface is large and intentionally left opaque.

optional Asyncify?: EmscriptenAsyncify

Defined in: packages/runtime/src/wasm/types.ts:296

Asyncify runtime — present when compiled with -sASYNCIFY and exported.


optional ENV?: Record<string, string>

Defined in: packages/runtime/src/wasm/types.ts:288

Emscripten’s environment variables — set before calling main().


FS: EmscriptenFS

Defined in: packages/runtime/src/wasm/types.ts:263

Emscripten’s in-memory filesystem.


optional noExitRuntime?: boolean

Defined in: packages/runtime/src/wasm/types.ts:273

If true, exit() does not abort the runtime — required for Asyncify.


optional noInitialRun?: boolean

Defined in: packages/runtime/src/wasm/types.ts:271

If true, the factory resolves without invoking main().


optional preRun?: (m) => void[]

Defined in: packages/runtime/src/wasm/types.ts:283

Hooks run before main() — inject env vars here.

EmscriptenModule

void


optional thisProgram?: string

Defined in: packages/runtime/src/wasm/types.ts:285

argv[0] value the program sees.


optional TTY?: EmscriptenTTY

Defined in: packages/runtime/src/wasm/types.ts:298

TTY subsystem — present when TTY is added to EXPORTED_RUNTIME_METHODS.


optional wasmBinary?: Uint8Array<ArrayBufferLike>

Defined in: packages/runtime/src/wasm/types.ts:269

Pre-provided WASM binary (bypasses Emscripten’s built-in fetch/locateFile).

_main(argc, argv): number

Defined in: packages/runtime/src/wasm/types.ts:267

Direct entry point — use instead of callMain() with Asyncify to avoid exitJS.

number

number

number


callMain(args): number

Defined in: packages/runtime/src/wasm/types.ts:265

Run the program’s main() with the given argv (argv[0] is excluded).

string[]

number


optional locateFile(path, prefix): string

Defined in: packages/runtime/src/wasm/types.ts:293

Override Emscripten’s file locator. When wasmBinary is provided this prevents the glue from calling new URL(name, import.meta.url) which fails when the glue is evaluated outside its original module context.

string

string

string


optional onExit(code): void

Defined in: packages/runtime/src/wasm/types.ts:281

Called when the program exits with the exit code.

number

void


optional print(text): void

Defined in: packages/runtime/src/wasm/types.ts:275

Override for normal stdout print.

string

void


optional printErr(text): void

Defined in: packages/runtime/src/wasm/types.ts:277

Override for stderr print.

string

void


optional stdin(): number | null

Defined in: packages/runtime/src/wasm/types.ts:279

Synchronous stdin callback — returns next byte, or null on EOF.

number | null