WebAssembly.instantiate

The WebAssembly.instantiate() function allows you to compile and instantiate WebAssembly code.

This 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.

MDN

function instantiate(bytes: BufferSource, importObject?: Imports): Promise<WebAssemblyInstantiatedSource>;
function instantiate(moduleObject: Module, importObject?: Imports): Promise<Instance>;
§
instantiate(bytes: BufferSource, importObject?: Imports): Promise<WebAssemblyInstantiatedSource>
[src]

The WebAssembly.instantiate() function allows you to compile and instantiate WebAssembly code.

This 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.

MDN

§Parameters

§
importObject?: Imports optional
[src]
§
instantiate(moduleObject: Module, importObject?: Imports): Promise<Instance>
[src]

The WebAssembly.instantiate() function allows you to compile and instantiate WebAssembly code.

This 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.

MDN

§Parameters

§
moduleObject: Module
[src]
§
importObject?: Imports optional
[src]

§Return Type