-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
30 lines (30 loc) · 892 Bytes
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<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>
<style>
body { background-color: #000; margin: 0;}
canvas {position: absolute; top:50%; left: 50%; transform: translate(-50%, -50%);}
</style>
</head>
<body>
</body>
</html>