Created
January 13, 2020 13:30
-
-
Save vbkmr/3a5975f37a78daab06716457940a1237 to your computer and use it in GitHub Desktop.
This file contains 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
fetch('factorial.wasm') | |
//getting WASM Module from response | |
.then(response => response.arrayBuffer()) | |
//instantiating WASM instance from WASM Module | |
.then(bytes => WebAssembly.instantiate(bytes)) | |
//using exported factorial fn from WASM Instance | |
.then(results => { | |
console.log(results.instance.exports.factorial(12)) | |
}) | |
WebAssembly.instantiateStreaming(fetch("factorial.wasm")).then(results => { | |
console.log(results.instance.exports.factorial(12)); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment