WebAssembly
js.lib.WebAssembly (extern class)
The WebAssembly JavaScript object acts as the namespace for all WebAssembly-related functionality.
Documentation WebAssembly by Mozilla Contributors, licensed under CC-BY-SA 2.5.
Static Members
The WebAssembly.instantiate() function allows you to compile and instantiate WebAssembly code.
This function has two overloads:
-
The primary overload takes the WebAssembly binary code, in the form of a typed array or ArrayBuffer,
and performs both compilation and instantiation in one step. The returned Promise resolves to both
a compiled WebAssembly.Module and its first WebAssembly.Instance.
-
The secondary overload takes an already-compiled WebAssembly.Module and returns a Promise that resolves
to an Instance of that Module. This overload is useful if the Module has already been compiled.
The WebAssembly.instantiateStreaming() function compiles and instantiates a WebAssembly module
directly from a streamed underlying source. This is the most efficient, optimized way to load wasm code.
The WebAssembly.compile() function compiles a WebAssembly Module from WebAssembly binary code.
This function is useful if it is necessary to a compile a module before it can be instantiated
(otherwise, the WebAssembly.instantiate() function should be used).
The WebAssembly.compileStreaming() function compiles a WebAssembly Module directly from a streamed
underlying source. This function is useful if it is necessary to a compile a module before it can
be instantiated (otherwise, the WebAssembly.instantiateStreaming() function should be used).
The WebAssembly.validate() function validates a given typed array of WebAssembly binary code,
returning whether the bytes form a valid wasm module (true) or not (false).