- Learn WebAssembly
- Mike Rourke
- 249字
- 2021-08-13 15:38:53
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.
推薦閱讀
- Visual Basic .NET程序設計(第3版)
- ASP.NET Web API:Build RESTful web applications and services on the .NET framework
- 數據庫程序員面試筆試真題與解析
- 潮流:UI設計必修課
- INSTANT FreeMarker Starter
- Unity 5.x By Example
- Learning Material Design
- HTML5開發精要與實例詳解
- .NET Standard 2.0 Cookbook
- Unity 2018 Augmented Reality Projects
- Python從入門到精通(第3版)
- 交互式程序設計(第2版)
- Mastering ArcGIS Server Development with JavaScript
- Tkinter GUI Programming by Example
- Python機器學習