This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for usage in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the specification changes.
WebAssembly.Moduleobject contains stateless WebAssembly code that has already been compiled by the browser and can be efficiently shared with Workers, cached in IndexedDB and instantiated multiple times.
WebAssembly.Module()constructor function can be called to synchronously compile given WebAssembly binary code. However, the primary way to get a
Moduleis through an asynchronous compilation function like
WebAssembly.compile()or by reading a Module out of IndexedDB.
Important: Since compilation for large modules can be expensive, developers should only use the
Module() constructor when synchronous compilation is absolutely required; the asynchronous
WebAssembly.compile() method should be used at all other times.
var myModule = new WebAssembly.Module(bufferSource);
- A typed array or ArrayBuffer containing the binary code of the .wasm module you want to compile.
Function Properties of the
- Given a
Moduleand string, returns a copy of the contents of all custom sections in the module with the given string name.
- Given a
Module, returns an array containing descriptions of all the declared exports.
- Given a
Module, returns an array containing descriptions of all the declared imports.
Module instances inherit from the
Module() constructor's prototype object — this can be modified to affect all
- Returns the function that created this object's instance. By default this is the
- The initial value of the @@toStringTag property is the String value "WebAssembly.Module".
Module instances have no default methods of their own.
The definition of 'WebAssembly.Module()' in that specification.
|Draft||Initial draft definition.|
|Feature||Chrome||Edge||Firefox (Gecko)||Internet Explorer||Opera||Safari (WebKit)|
|Basic support||57||15||52 (52)||No support||44||11|
|Feature||Chrome for Android||Android Webview||Edge Mobile||Firefox Mobile (Gecko)||IE Mobile||Opera Mobile||Safari Mobile|
|Basic support||57||57||No support||52.0 (52)||No support||No support||11|
 WebAssembly is enabled in Firefox 52+, although disabled in the Firefox 52 Extended Support Release (ESR.)