mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
docs(manual/wasm): add more example code. (#10250)
This commit is contained in:
parent
ffc01f9fc5
commit
a1ac17f9fa
1 changed files with 10 additions and 0 deletions
|
@ -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());
|
||||
```
|
||||
|
|
Loading…
Reference in a new issue