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.
Properties
Section titled “Properties”Asyncify?
Section titled “Asyncify?”
optionalAsyncify?:EmscriptenAsyncify
Defined in: packages/runtime/src/wasm/types.ts:296
Asyncify runtime — present when compiled with -sASYNCIFY and exported.
optionalENV?: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.
noExitRuntime?
Section titled “noExitRuntime?”
optionalnoExitRuntime?:boolean
Defined in: packages/runtime/src/wasm/types.ts:273
If true, exit() does not abort the runtime — required for Asyncify.
noInitialRun?
Section titled “noInitialRun?”
optionalnoInitialRun?:boolean
Defined in: packages/runtime/src/wasm/types.ts:271
If true, the factory resolves without invoking main().
preRun?
Section titled “preRun?”
optionalpreRun?: (m) =>void[]
Defined in: packages/runtime/src/wasm/types.ts:283
Hooks run before main() — inject env vars here.
Parameters
Section titled “Parameters”EmscriptenModule
Returns
Section titled “Returns”void
thisProgram?
Section titled “thisProgram?”
optionalthisProgram?:string
Defined in: packages/runtime/src/wasm/types.ts:285
argv[0] value the program sees.
optionalTTY?:EmscriptenTTY
Defined in: packages/runtime/src/wasm/types.ts:298
TTY subsystem — present when TTY is added to EXPORTED_RUNTIME_METHODS.
wasmBinary?
Section titled “wasmBinary?”
optionalwasmBinary?:Uint8Array<ArrayBufferLike>
Defined in: packages/runtime/src/wasm/types.ts:269
Pre-provided WASM binary (bypasses Emscripten’s built-in fetch/locateFile).
Methods
Section titled “Methods”_main()
Section titled “_main()”_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.
Parameters
Section titled “Parameters”number
number
Returns
Section titled “Returns”number
callMain()
Section titled “callMain()”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).
Parameters
Section titled “Parameters”string[]
Returns
Section titled “Returns”number
locateFile()?
Section titled “locateFile()?”
optionallocateFile(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.
Parameters
Section titled “Parameters”string
prefix
Section titled “prefix”string
Returns
Section titled “Returns”string
onExit()?
Section titled “onExit()?”
optionalonExit(code):void
Defined in: packages/runtime/src/wasm/types.ts:281
Called when the program exits with the exit code.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”void
print()?
Section titled “print()?”
optionalprint(text):void
Defined in: packages/runtime/src/wasm/types.ts:275
Override for normal stdout print.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
printErr()?
Section titled “printErr()?”
optionalprintErr(text):void
Defined in: packages/runtime/src/wasm/types.ts:277
Override for stderr print.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
stdin()?
Section titled “stdin()?”
optionalstdin():number|null
Defined in: packages/runtime/src/wasm/types.ts:279
Synchronous stdin callback — returns next byte, or null on EOF.
Returns
Section titled “Returns”number | null