1. 웹어셈블리
  2. Reference
  3. WebAssembly
  4. WebAssembly.compileStreaming()

This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

WebAssembly.compileStreaming()

Baseline Widely available *

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨2021년 9월⁩.

* Some parts of this feature may have varying levels of support.

**WebAssembly.compileStreaming()**함수는 스트림 된 원본 소스에서 직접 WebAssembly.Module을 컴파일합니다. 이 함수는 모듈을 인스턴스화하기 전에 컴파일해야하는 경우 유용합니다 (그렇지 않으면 WebAssembly.instantiateStreaming () 함수를 사용해야합니다).

Syntax

js
WebAssembly.compileStreaming(source);

Parameters

source

스트리밍 및 컴파일하려는 .wasm 모듈의 기본 소스를 나타내는 Response 객체 또는 약속을 수행합니다.

Return value

Promise는 컴파일 된 모듈로 표현된 WebAssembly.Module 객체로 반환됩니다.

Exceptions

Examples

다음 예제 (GitHub의 compile-streaming.html 데모 및 라이브보기)에서 기본 소스의 .wasm 모듈을 직접 스트리밍 한 다음 WebAssembly.Module 객체로 컴파일합니다. compileStreaming() 함수는 Response 객체에 대한 promise를 받으므로 직접 fetch() 호출을 전달할 수 있습니다.

js
var importObject = { imports: { imported_func: (arg) => console.log(arg) } };
WebAssembly.compileStreaming(fetch("simple.wasm"))
 .then((module) => WebAssembly.instantiate(module, importObject))
 .then((instance) => instance.exports.exported_func());

결과 모듈 인스턴스는 WebAssembly.instantiate ()를 사용하여 인스턴스화되고 내 보낸 함수가 호출됩니다.

명세서

Specification
WebAssembly Web API
# dom-webassembly-compilestreaming

브라우저 호환성

See also

Help improve MDN

Learn how to contribute

This page was last modified on by MDN contributors.

AltStyle によって変換されたページ (->オリジナル) /