emscripten-wasm-loader
Version:
Common interface to load wasm module into isomorphic environment
26 lines • 1.47 kB
TypeScript
/**
* Runtime generated by requiring module satisfies runtimeModuleType.
* `initializeRuntime` is injected via `constructModule` for awaitable module initialization.
*/
interface AsmRuntimeType {
initializeRuntime: (timeout?: number) => Promise<boolean>;
}
/**
* @internal
* Build Record<string, any> object to be injected when creates runtime for asm module.
* Modularized asm module generated via MODULARIZE=1 accepts object as its creation function allow to attach
* properties. Using those, this function construct few essential convinient functions like awaitable runtime init.
*
* Note some init like exporting in-memory FS functions can't be achieved via module object but should rely on
* preprocessor (https://github.com/kwonoj/docker-hunspell-wasm/blob/eba7781311b31028eefb8eb3e2457d11f294e076/preprocessor.js#L14-L27)
* to access function-scope variables inside.
*
* @param {Record<string, any>} value pre-constructed value to be used, or empty object {}.
* @param {string} [binaryEndpoint] Provides endpoint to server to download binary module.
* This value is for browser only - on node.js, should rely on emscripten's default resolution.
*
* @returns {Record<string, any>} Augmented object with prefilled interfaces.
*/
declare const constructModule: (value: Record<string, string>, binaryRemoteEndpoint?: string | undefined) => AsmRuntimeType;
export { AsmRuntimeType, constructModule };
//# sourceMappingURL=constructModule.d.ts.map