Skip to content

Instantly share code, notes, and snippets.

@FreeMasen
Created July 24, 2018 20:58
Show Gist options
  • Save FreeMasen/ed8848c795c53d6d054bc5a2db5d9e1c to your computer and use it in GitHub Desktop.
Save FreeMasen/ed8848c795c53d6d054bc5a2db5d9e1c to your computer and use it in GitHub Desktop.
let wasm;
fetch('/rust_program_name.wasm')
.then(res => res.arrayBuffer())
.then(buf => {
return WebAssembly.Instantiate(buf, importObject)
.then(mod => {
wasm = mod.instance.exports;
start();
});
});
function start() {
wasm.start();
}
function wasm_one() {
}
function wasm_two() {
}
var importObject = {
'./rust_program_name': {
wasm_one: wasm_one,
wasm_two: wasm_two,
},
'__wbindgen_placeholder__': {
place_holder_fn: function() {},
wasm_two: function() {},
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment