Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.