이 번역은 완료되지 않았습니다. 이 문서를 번역해 주세요.
WebAssembly.Module 객체는 브라우저에서 이미 컴파일 된 stateless WebAssembly 코드를 포함하며 Workers와 효율적으로 공유하고 여러 번 인스턴스화 할 수 있습니다.
WebAssembly.Module() 생성자 함수를 호출하여 지정된 WebAssembly 바이너리 코드를 동기식으로 컴파일 할 수 있습니다. 그러나 Module을 쓰는 주된 방법은 WebAssembly.compile ()과 같은 비동기 컴파일 함수를 사용하는 것입니다.
생성자 구문
Important: 대형 모듈의 컴파일은 비용이 많이들 수 있으므로 개발자는 동기 컴파일이 절대적으로 필요한 경우에만 Module () 생성자를 사용해야합니다. 비동기 WebAssembly.compileStreaming () 메서드를 사용하세요.
var myModule = new WebAssembly.Module(bufferSource);
매개변수
bufferSource- 컴파일 할 .wasm 모듈의 이진 코드가 들어있는 typed array또는 ArrayBuffer입니다.
Function Properties of the Module Constructor
WebAssembly.Module.customSections()- 모듈과 문자열이 주어지면 모듈의 모든 사용자 정의 섹션 내용의 사본을 주어진 문자열 이름으로 반환합니다.
WebAssembly.Module.exports()- 모듈이 주어지면 선언 된 모든 내보내기에 대한 설명이 들어있는 배열을 반환합니다.
WebAssembly.Module.imports()
모듈이 주어지면 선언 된 모든 가져 오기에 대한 설명이 들어있는 배열을 반환합니다.
Module instances
모든 Module 인스턴스는 Module() 생성자의 prototype object에서 상속받습니다.이 인스턴스는 모든 Module 인스턴스에 적용되도록 수정할 수 있습니다.
Instance properties
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".
Instance methods
모듈 인스턴스에는 기본 메서드가 없습니다.
명세
| Specification | Status | Comment |
|---|---|---|
| WebAssembly JavaScript Interface The definition of 'WebAssembly.Module()' in that specification. |
Working Draft | Initial draft definition. |
브라우저 호환성
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
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 | iOS Safari | Samsung Internet | Node.js | |
| Basic support | Chrome Full support 57 | Edge Full support 16 | Firefox
Full support
52
| 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
| Firefox Android
Full support
52
| 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
| 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
| Firefox Android
Full support
52
| 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
| 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
| Firefox Android
Full support
52
| 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
| 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
| Firefox Android
Full support
52
| 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
| 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
| Firefox Android
Full support
52
| 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.