`WebAssembly.Module` 对象包含已经由浏览器编译的无状态 WebAssembly 代码，可以高效地与 Workers 共享、缓存在 IndexedDB 中，和多次实例化。
`WebAssembly.Module()` 构造函数可以用来同步编译给定的 WebAssembly 二进制代码。不过，获取 `Module` 对象的主要方法是通过异步编译函数，如 `WebAssembly.compile()`，或者是通过 IndexedDB 读取 Module 对象.

## 构造函数语法

重要提示：由于大型模块的编译可能很消耗资源，开发人员只有在绝对需要同步编译时，才使用 `Module()` 构造函数；其他情况下，应该使用异步 `WebAssembly.compile()` 方法。

    var myModule = new WebAssembly.Module(bufferSource);

### 参数

bufferSource
  一个 类型化数组 或 ArrayBuffer，包含要编译的 .wasm 模块的二进制代码。

## `Module` 构造函数的方法属性

`WebAssembly.Module.customSections()`
  给定 `Module` 对象和字符串，通过该字符串，返回 Module 对象中所有自定义部分的内容的副本。
`WebAssembly.Module.exports()`
  给定 `Module` 对象，返回一个数组，内容是所有已声明的接口的描述。
`WebAssembly.Module.imports()`
  给定 `Module` 对象，返回一个数组，内容是所有已声明的引用的描述。

## `Module` 实例

所有 `Module` 实例继承自 `Module()` 构造函数的原型对象 —— 修改它会影响所有 `Module` 实例。

### 实例属性

`Module.prototype.constructor`
  Returns the function that created this object's instance. By default this is the `WebAssembly.Module()` constructor.
`Module.prototype[@@toStringTag]`
  The initial value of the @@toStringTag property is the String value "WebAssembly.Module".

### 实例方法

Module 实例没有自己的默认方法。

## 规范

规范 | 状态 | 注释
--- | --- | ---
WebAssembly JavaScript Interface WebAssembly.Module() | Working Draft | 定义初稿

## 浏览器兼容性

此页面上的兼容性表格由结构化数据生成。 如果您想为数据做出贡献，请查看 https://github.com/mdn/browser-compat-data 并向我们发送合并请求。

Update compatibility data on GitHub

| Desktop | Mobile | Server
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | Safari on iOS | Samsung Internet | Node.js
`Module` | Chrome Full support 57 | Edge Full support 16 | Firefox Full support 52 Notes Full support 52 Notes Notes Disabled in the Firefox 52 Extended Support Release (ESR). | IE No support No | Opera Full support 44 | Safari Full support 11 | WebView Android Full support 57 | Chrome Android Full support 57 | Edge Mobile Full support Yes Disabled Full support Yes Disabled Disabled This feature is behind the `Experimental JavaScript Features` preference. | Firefox Android Full support 52 Notes Full support 52 Notes Notes Disabled in the Firefox 52 Extended Support Release (ESR). | Opera Android ? | Safari iOS Full support 11 | Samsung Internet Android Full support 7.0 | nodejs Full support 8.0.0
`customSections` | Chrome Full support 57 | Edge Full support 16 | Firefox Full support 52 Notes Full support 52 Notes Notes Disabled in the Firefox 52 Extended Support Release (ESR). | IE No support No | Opera Full support 44 | Safari Full support 11 | WebView Android Full support 57 | Chrome Android Full support 57 | Edge Mobile Full support Yes Disabled Full support Yes Disabled Disabled This feature is behind the `Experimental JavaScript Features` preference. | Firefox Android Full support 52 Notes Full support 52 Notes Notes Disabled in the Firefox 52 Extended Support Release (ESR). | Opera Android ? | Safari iOS Full support 11 | Samsung Internet Android Full support 7.0 | nodejs Full support 8.0.0
`exports` | Chrome Full support 57 | Edge Full support 16 | Firefox Full support 52 Notes Full support 52 Notes Notes Disabled in the Firefox 52 Extended Support Release (ESR). | IE No support No | Opera Full support 44 | Safari Full support 11 | WebView Android Full support 57 | Chrome Android Full support 57 | Edge Mobile Full support Yes Disabled Full support Yes Disabled Disabled This feature is behind the `Experimental JavaScript Features` preference. | Firefox Android Full support 52 Notes Full support 52 Notes Notes Disabled in the Firefox 52 Extended Support Release (ESR). | Opera Android ? | Safari iOS Full support 11 | Samsung Internet Android Full support 7.0 | nodejs Full support 8.0.0
`imports` | Chrome Full support 57 | Edge Full support 16 | Firefox Full support 52 Notes Full support 52 Notes Notes Disabled in the Firefox 52 Extended Support Release (ESR). | IE No support No | Opera Full support 44 | Safari Full support 11 | WebView Android Full support 57 | Chrome Android Full support 57 | Edge Mobile Full support Yes Disabled Full support Yes Disabled Disabled This feature is behind the `Experimental JavaScript Features` preference. | Firefox Android Full support 52 Notes Full support 52 Notes Notes Disabled in the Firefox 52 Extended Support Release (ESR). | Opera Android ? | Safari iOS Full support 11 | Samsung Internet Android Full support 7.0 | nodejs Full support 8.0.0
`prototype` | Chrome Full support 57 | Edge Full support 16 | Firefox Full support 52 Notes Full support 52 Notes Notes Disabled in the Firefox 52 Extended Support Release (ESR). | IE No support No | Opera Full support 44 | Safari Full support 11 | WebView Android Full support 57 | Chrome Android Full support 57 | Edge Mobile Full support Yes Disabled Full support Yes Disabled Disabled This feature is behind the `Experimental JavaScript Features` preference. | Firefox Android Full support 52 Notes Full support 52 Notes Notes Disabled in the Firefox 52 Extended Support Release (ESR). | Opera Android ? | Safari iOS Full support 11 | Samsung Internet Android Full support 7.0 | nodejs Full support 8.0.0

### Legend

Full support
  Full support
No support
  No support
Compatibility unknown
  Compatibility unknown
See implementation notes.
  See implementation notes.
User must explicitly enable this feature.
  User must explicitly enable this feature.

## 另请查阅

- WebAssembly 概览页面
- WebAssembly 概念
- 使用 WebAssembly JavaScript API