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

  • Learn WebAssembly
  • Mike Rourke
  • 189字
  • 2021-08-13 15:38:53

WebAssembly.Module

The WebAssembly.Module object is the intermediate step between the ArrayBuffer and the instantiated module. The compile() and instantiate() methods (and their streaming counterparts) return a Promise that resolves with a module (module in lowercase represents the compiled Module). A module can also be created synchronously by passing a typed array or ArrayBuffer directly into the constructor, but this is discouraged for large modules.

The Module object also has three static methods: exports(), imports(), and customSections(). All three take a module as a parameter, but customSections() takes a string representing the section name as its second parameter. Custom sections are described in the Binary Format section of the Core Specification and are intended to be used for debugging information or third-party extensions. In most cases, you won't need to define these. The exports() function is useful if you're using a Wasm module that you didn't create, although you'll only be able to see the name and kind (for example, function) of each export.

For simple use cases, you won't be dealing directly with the Module object or compiled module. Most of the interaction will take place with an Instance.

主站蜘蛛池模板: 邵武市| 来安县| 龙里县| 吉木乃县| 丽水市| 台前县| 梁山县| 西充县| 拉孜县| 德昌县| 临桂县| 新乡市| 藁城市| 延川县| 灵璧县| 克拉玛依市| 武山县| 两当县| 沙河市| 大城县| 赞皇县| 五原县| 城口县| 普兰县| 江华| 商南县| 祁阳县| 上杭县| 治县。| 清镇市| 额济纳旗| 汉中市| 连平县| 贺兰县| 儋州市| 湖南省| 阿巴嘎旗| 临泉县| 隆子县| 霍林郭勒市| 永宁县|