mach/www/template.html
iddev5 40c0659cc9 mach: App.update will now return !void instead of !bool
In order to close the application, there is already
Engine.setShouldClose() which would roughly do the same thing.
2022-06-08 07:31:53 -07:00

37 lines
824 B
HTML

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<style>
canvas {{
border: 1px solid;
}}
</style>
</head>
<body>
<script type="module">
import {{ mach }} from "./mach.js";
let imports = {{
env: mach,
}};
fetch("{s}.wasm")
.then(response => response.arrayBuffer())
.then(buffer => WebAssembly.instantiate(buffer, imports))
.then(results => results.instance)
.then(instance => {{
mach.init(instance);
instance.exports.wasmInit();
let update = function() {{
instance.exports.wasmUpdate();
requestAnimationFrame(update);
}};
requestAnimationFrame(update);
}})
.catch(err => console.error(err));
</script>
</body>
</html>