JavaScript

How to use the WebAssembly JS Promise Integration (JSPI)?

Hard
4
Added
Async WebAssembly via promise integration. Allows await in WASM (Stage 2).

Solution Code

JavaScript
// WASM
async function fetchData() {
  let ptr = await fetch(...);
}
// JS
WebAssembly.instantiateStreaming(fetch('module.wasm'));
Explanation
Bridges JS async capabilities with WASM. Requires stack switching.

Guided Hints

Suspender model
Performance impact