这篇翻译不完整。请帮忙从英语翻译这篇文章

这是一个实验中的功能
此功能某些浏览器尚在开发中,请参考浏览器兼容性表格以得到在不同浏览器中适合使用的前缀。由于该功能对应的标准文档可能被重新修订,所以在未来版本的浏览器中该功能的语法和行为可能随之改变。

A WebAssembly.Instance object is a stateful, executable instance of a WebAssembly.ModuleInstance objects contain all the Exported WebAssembly functions that allow calling into WebAssembly code from JavaScript.

WebAssembly.Instance实例对象是有状态,可执行的 WebAssembly.Module实例。实例中包含了所有可以被 JavaScript调用的WebAssembly 代码导出的函数。

The WebAssembly.Instance() constructor function can be called to synchronously instantiate a given WebAssembly.Module object. However, the primary way to get an Instance is through the asynchronous WebAssembly.instantiate() function.

Constructor Syntax

Important: Since instantiation for large modules can be expensive, developers should only use the Instance() constructor when synchronous instantiation is absolutely required; the asynchronous WebAssembly.instantiate() method should be used at all other times.

var myInstance = new WebAssembly.Instance(module, importObject);

Parameters

module
The WebAssembly.Module object to be instantiated.
importObject 可选
An object containing the values to be imported into the newly-created Instance, such as functions or WebAssembly.Memory objects. There must be one matching property for each declared import of module or else a WebAssembly.LinkError is thrown.

Instance instances

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

Instance properties

Instance.prototype.constructor
Returns the function that created this object's instance. By default this is the WebAssembly.Instance() constructor.
Instance.prototype.exports Read only
Returns an object containing as its members all the functions exported from the WebAssembly module instance, to allow them to be accessed and used by JavaScript.

Instance methods

None.

Specifications

Specification Status Comment
WebAssembly JavaScript API
Instance
Draft Initial draft definition.

Browser compatibility

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 57 15[2] 52 (52)[1] 未实现 44 11
Feature Chrome for Android Android Webview Edge Mobile Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support 57 57 未实现 52.0 (52)[1] 未实现 未实现 11

[1] WebAssembly is enabled in Firefox 52+, although disabled in the Firefox 52 Extended Support Release (ESR.)

[2] Currently supported behind the “Experimental JavaScript Features” flag. See this blog post for more details.

See also

文档标签和贡献者

 此页面的贡献者: SphinxKnight
 最后编辑者: SphinxKnight,