WasmModule
A pure static utility class which supports immediate and lazy loading of wasm modules.
Summary
Static Methods
getInstance | Get a wasm module instance. |
setConfig | Set a wasm module's configuration. |
Details
Static Methods
getInstance(moduleName, callback)
Get a wasm module instance. The instance will be created if necessary and returned in the second parameter to callback.
Parameters
moduleName | string | Name of the module. |
callback | ModuleInstanceCallback | The function called when the instance is available. |
setConfig(moduleName, [config])
Set a wasm module's configuration.
Parameters
moduleName | string | Name of the module. |
config | object | The configuration object. |
config.glueUrl | string | URL of glue script. |
config.wasmUrl | string | URL of the wasm script. |
config.fallbackUrl | string | URL of the fallback script to use when wasm modules aren't supported. |
config.errorHandler | ModuleErrorCallback | Function to be called if the module fails to download. |