API Reference

Class List

WasmModule

A pure static utility class which supports immediate and lazy loading of wasm modules.

Summary

Static Methods

getConfig

Get a wasm module's configuration.

getInstance

Get a wasm module instance.

setConfig

Set a wasm module's configuration.

Details

Static Methods

getConfig(moduleName)

Get a wasm module's configuration.

Parameters

moduleNamestring

Name of the module.

Returns

object, undefined

The previously set configuration.

getInstance(moduleName, callback)

Get a wasm module instance. The instance will be created if necessary and returned in the second parameter to callback.

Parameters

moduleNamestring

Name of the module.

callbackModuleInstanceCallback

The function called when the instance is available.

setConfig(moduleName, [config])

Set a wasm module's configuration.

Parameters

moduleNamestring

Name of the module.

configobject

The configuration object.

config.glueUrlstring

URL of glue script.

config.wasmUrlstring

URL of the wasm script.

config.fallbackUrlstring

URL of the fallback script to use when wasm modules aren't supported.

config.numWorkersnumber

For modules running on worker threads, the number of threads to use. Default value is based on module implementation.

config.errorHandlerModuleErrorCallback

Function to be called if the module fails to download.

Constructor

WasmModule()