1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-10 16:11:13 -05:00

docs(cli): Update web assembly example and accepted compiler options in docs. (#7678)

Fixes #7556 
Fixes #7634
This commit is contained in:
Search 2020-09-27 01:18:32 +05:30 committed by GitHub
parent c03fe284cf
commit 52c67d301c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View file

@ -154,6 +154,7 @@ Following are the currently allowed settings and their default values in Deno:
"generateCpuProfile": "profile.cpuprofile", "generateCpuProfile": "profile.cpuprofile",
"jsx": "react", "jsx": "react",
"jsxFactory": "React.createElement", "jsxFactory": "React.createElement",
"jsxFragmentFactory": "React.Fragment",
"lib": [], "lib": [],
"noFallthroughCasesInSwitch": false, "noFallthroughCasesInSwitch": false,
"noImplicitAny": true, "noImplicitAny": true,

View file

@ -4,7 +4,7 @@ Deno can execute [WebAssembly](https://webassembly.org/) binaries.
<!-- dprint-ignore --> <!-- dprint-ignore -->
```js ```ts
const wasmCode = new Uint8Array([ const wasmCode = new Uint8Array([
0, 97, 115, 109, 1, 0, 0, 0, 1, 133, 128, 128, 128, 0, 1, 96, 0, 1, 127, 0, 97, 115, 109, 1, 0, 0, 0, 1, 133, 128, 128, 128, 0, 1, 96, 0, 1, 127,
3, 130, 128, 128, 128, 0, 1, 0, 4, 132, 128, 128, 128, 0, 1, 112, 0, 0, 3, 130, 128, 128, 128, 0, 1, 0, 4, 132, 128, 128, 128, 0, 1, 112, 0, 0,
@ -15,5 +15,6 @@ const wasmCode = new Uint8Array([
]); ]);
const wasmModule = new WebAssembly.Module(wasmCode); const wasmModule = new WebAssembly.Module(wasmCode);
const wasmInstance = new WebAssembly.Instance(wasmModule); const wasmInstance = new WebAssembly.Instance(wasmModule);
const main = wasmInstance.exports.main as CallableFunction
console.log(wasmInstance.exports.main().toString()); console.log(wasmInstance.exports.main().toString());
``` ```