Skip to content

Commit c3fee28

Browse files
committed
add docs for dynamic form
1 parent db58cd4 commit c3fee28

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

doc/api/esm.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,17 @@ const instance2 = await WebAssembly.instantiate(libraryModule, {
722722
});
723723
```
724724
725+
In addition to the static source phase, there is also a dynamic variant of the
726+
source phase via the `import.source` dynamic phase import syntax:
727+
728+
```js
729+
const dynamicLibrary = await import.source('./library.wasm');
730+
731+
const instance = await WebAssembly.instantiate(dynamicLibrary, {
732+
custom: import
733+
});
734+
```
735+
725736
<i id="esm_experimental_top_level_await"></i>
726737
727738
## Top-level `await`

0 commit comments

Comments
 (0)