summaryrefslogtreecommitdiff
path: root/std/wasi/README.md
diff options
context:
space:
mode:
authorCasper Beyer <caspervonb@pm.me>2020-11-03 01:50:45 +0800
committerGitHub <noreply@github.com>2020-11-02 18:50:45 +0100
commitc5611636fb03ce71f50a9bca958c79d23b55be00 (patch)
treed9e5e3c9fbae15c7e0d636bd823e618d6a2cffef /std/wasi/README.md
parenta8ca9fe7bb93d031af865ffcf45fb265395f1e1b (diff)
feat(std/wasi): add start method to Context (#8141)
This adds a start method to the Context to make starting a command less tedious and yield consistent errors. Manually setting the memory is still valid for more complex scenarios, just undocumented for the time being.
Diffstat (limited to 'std/wasi/README.md')
-rw-r--r--std/wasi/README.md18
1 files changed, 1 insertions, 17 deletions
diff --git a/std/wasi/README.md b/std/wasi/README.md
index 1f78e9ac7..829b25174 100644
--- a/std/wasi/README.md
+++ b/std/wasi/README.md
@@ -68,21 +68,5 @@ const instance = await WebAssembly.instantiate(module, {
"wasi_snapshot_preview1": context.exports,
});
-const {
- _start: start,
- _initialize: initialize,
- memory,
-} = instance.exports;
-
-context.memory = memory as WebAssembly.Memory;
-
-if (start instanceof Function) {
- start();
-} else if (initialize instanceof Function) {
- initialize();
-} else {
- throw new Error(
- "No '_start' or '_initialize' entry point found in WebAssembly module, make sure to compile with wasm32-wasi as the target.",
- );
-}
+context.start(instance);
```