This repository has been archived by the owner on Aug 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
48 lines (48 loc) · 1.44 KB
/
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="initial-scale=1">
<title>gruid Application Title</title>
<!--<link rel="stylesheet" type="text/css" href="style.css" />-->
</head>
<body>
<script src="wasm_exec.js"></script>
<!--<script src="screenfull.min.js"></script>-->
<div id="appdiv">
<canvas id="appcanvas">
Application Screen
</canvas>
</div>
<div style="display:none">
<img id="loading" src="loading-screen.png" alt="Application Loading Screen">
</div>
<script>
var wasmfile = "app.wasm";
var canvas = document.getElementById("appcanvas");
var ctx = canvas.getContext("2d");
var loadingImg = document.getElementById("loading");
canvas.width = loadingImg.naturalWidth;
canvas.height = loadingImg.naturalHeight;
ctx.drawImage(loadingImg, 0, 0);
// var appdiv = document.getElementById("appdiv");
// document.getElementById('goFS').addEventListener('click', () => {
// if (screenfull.enabled) {
// screenfull.request(appdiv);
// }
// });
if (!WebAssembly.instantiateStreaming) { // polyfill
WebAssembly.instantiateStreaming = async (resp, importObject) => {
const source = await (await resp).arrayBuffer();
return await WebAssembly.instantiate(source, importObject);
};
}
const go = new Go();
WebAssembly.instantiateStreaming(fetch(wasmfile), go.importObject).then((result) => {
go.run(result.instance);
}).catch((err) => {
console.error(err);
});
</script>
</body>
</html>