Module

WebAssembly module wrapper.

Usage

var Module = require( '@stdlib/wasm/module-wrapper' );

Module( binary, memory[, imports] )

Returns a new WebAssembly module wrapper instance.

// TO-DO: example

The function accepts the following arguments:

  • binary: WebAssembly binary code.
  • memory: WebAssembly memory instance.
  • imports: WebAssembly module imports object.

Module.prototype.buffer

Read-only property which returns a WebAssembly memory buffer as a Uint8Array.

// TO-DO: example

Methods

Module.prototype.isView( arr )

Returns a boolean indicating whether a provided list of values is a view of the underlying memory of the WebAssembly module.

// TO-DO: example

Examples

var hasWebAssemblySupport = require( '@stdlib/assert/has-wasm-support' );
var Module = require( '@stdlib/wasm/module-wrapper' );

function main() {
    if ( !hasWebAssemblySupport() ) {
        console.error( 'Environment does not support WebAssembly.' );
        return;
    }
    console.log( typeof Module ); // TO-DO: write example
}

main();
Did you find this page helpful?