官术网_书友最值得收藏!

WebAssembly objects

In addition to the methods covered in the Loading a module and the WebAssembly namespace methods section, the global WebAssembly object has child objects that are used to interact with and troubleshoot WebAssembly. These objects correlate directly to the concepts we discussed in the sections on the WebAssembly binary and text formats. The following list contains these objects as well as their definitions taken from MDN:

  • The WebAssembly.Module object 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
  • The WebAssembly.Instance object is a stateful, executable instance of a WebAssembly.Module which contains all of the exported WebAssembly functions that allow calling into WebAssembly code from JavaScript
  • WebAssembly.Memory, when called with the constructor, creates a new Memory object which is a resizable ArrayBuffer that holds the raw bytes of memory accessed by a WebAssembly Instance
  • WebAssembly.Table, when called with the constructor, creates a new Table object of the given size and element type that represents a WebAssembly Table (which stores function references)
  • WebAssembly.CompileError, when called with the constructor, creates an error which indicates that an issue occurred during WebAssembly decoding, or validation
  • WebAssembly.LinkError, when called with the constructor, creates an error which indicates that an issue occurred during module instantiation
  • WebAssembly.RuntimeError, when called with the constructor, creates an error which indicates that WebAssembly specified a trap (for example, stack overflow occurred)

Let's dig into each one individually, starting with the WebAssembly.Module object.

主站蜘蛛池模板: 昂仁县| 灵宝市| 上饶县| 泸溪县| 墨玉县| 洪江市| 武平县| 龙口市| 上饶市| 育儿| 青海省| 云和县| 广灵县| 桃江县| 大丰市| 顺昌县| 阿拉善盟| 东至县| 普兰县| 达孜县| 漯河市| 柘城县| 阳高县| 平江县| 龙川县| 满洲里市| 大名县| 华坪县| 桦川县| 邯郸市| 万源市| 昌图县| 高州市| 突泉县| 江阴市| 普宁市| 张家口市| 左权县| 邹平县| 南江县| 新竹县|