Skip to content

Commit

Permalink
docs(manual/wasm): add more example code. (#10250)
Browse files Browse the repository at this point in the history
  • Loading branch information
grian32 authored Apr 21, 2021
1 parent ffc01f9 commit a1ac17f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/getting_started/webassembly.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,13 @@ const wasmInstance = new WebAssembly.Instance(wasmModule);
const main = wasmInstance.exports.main as CallableFunction
console.log(main().toString());
```

And for files:

```ts
const wasmCode = await Deno.readFile("main.wasm");
const wasmModule = new WebAssembly.Module(wasmCode);
const wasmInstance = new WebAssembly.Instance(wasmModule);
const main = wasmInstance.exports.main as CallableFunction;
console.log(main().toString());
```

0 comments on commit a1ac17f

Please sign in to comment.