Skip to content

Instantly share code, notes, and snippets.

@gskachkov
Created November 27, 2017 19:53
Show Gist options
  • Save gskachkov/d9d54bc6529a9c57e4779315baa147d5 to your computer and use it in GitHub Desktop.
Save gskachkov/d9d54bc6529a9c57e4779315baa147d5 to your computer and use it in GitHub Desktop.
var importObject = {
imports: {
imported_func: function(arg) {
console.log(arg);
}
}
};
fetch('simple.wasm').then(response =>
response.arrayBuffer()
).then(bytes =>
WebAssembly.instantiate(bytes, importObject);
).then(function(mod) {
var imports = WebAssembly.Module.imports(mod);
console.log(imports[0]);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment