Created
July 4, 2022 09:28
-
-
Save esimov/6bd0d2bdaeae42f6f6c51dcdcb85e502 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
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<script src="js/wasm_exec.js"></script> | |
<script type="text/javascript"> | |
function fetchAndInstantiate(url, importObject) { | |
return fetch(url).then(response => | |
response.arrayBuffer() | |
).then(bytes => | |
WebAssembly.instantiate(bytes, importObject) | |
).then(results => | |
results.instance | |
); | |
} | |
var go = new Go(); | |
var mod = fetchAndInstantiate("lib.wasm", go.importObject); | |
window.onload = function () { | |
mod.then(function (instance) { | |
go.run(instance); | |
}); | |
}; | |
</script> | |
</head> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment