Created
September 5, 2019 15:01
-
-
Save gonzaloruizdevilla/a8743476a732974bcfbdf63c39d88ff7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//A memory created by JavaScript or in WebAssembly code will be accessible and mutable from both JavaScript and WebAssembly. | |
const memory = new WebAssembly.Memory({ initial:initial * 2 }); | |
//Instantiating Wasm module | |
const importObject = { env: { memory, abort: () => console.log("Abort!") }}; | |
const {instance} = await WebAssembly.instantiateStreaming( | |
fetch("./build/untouched.wasm"), | |
importObject | |
); | |
//Creating a typed array reference to write into the memory buffer | |
const mem = new Uint8Array(memory.buffer); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment