Unsere Freiwilligen haben diesen Artikel noch nicht in Deutsch übersetzt. Machen Sie mit und helfen Sie, das zu erledigen!
Sie können den Artikel auch auf English (US) lesen.

A WebAssembly.Module object contains stateless WebAssembly code that has already been compiled by the browser and can be efficiently shared with Workers, and instantiated multiple times. To instantiate the module, call the secondary overload of WebAssembly.instantiate().
The WebAssembly.Module() constructor function can be called to synchronously compile given WebAssembly binary code. However, the primary way to get a Module is through an asynchronous compilation function like WebAssembly.compile().

Constructor Syntax

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.compileStreaming() 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 Module Constructor

Given a Module and 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

All Module instances inherit from the Module() constructor's prototype object — this can be modified to affect all Module instances.

Instance properties

Returns the function that created this object's instance. By default this is the WebAssembly.Module() constructor.
The initial value of the @@toStringTag property is the String value "WebAssembly.Module".

Instance methods

Module instances have no default methods of their own.


Specification Status Comment
WebAssembly JavaScript Interface
The definition of 'WebAssembly.Module()' in that specification.
Working Draft Initial draft definition.

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support5716522 No4411
customSections5716522 No4411
exports5716522 No4411
imports5716522 No4411
prototype5716522 No4411
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support5757 Yes1522 ?117.0
customSections5757 Yes1522 ?117.0
exports5757 Yes1522 ?117.0
imports5757 Yes1522 ?117.0
prototype5757 Yes1522 ?117.0

1. This feature is behind the Experimental JavaScript Features preference.

2. Disabled in the Firefox 52 Extended Support Release (ESR).

See also

Schlagwörter des Dokuments und Mitwirkende

Mitwirkende an dieser Seite: MarkusStange, chrisdavidmills, fscholz, lukewagner
Zuletzt aktualisiert von: MarkusStange,