ui/eg/wasm-common/index.html
Noah Petherbridge 36db160533 Window Manager Buttons and Bugfixes
* Fix Supervisor event issues wrt. the window manager feature: if a
  focused window exists and Supervisor is running events for the "other"
  widgets not in managed windows, and the mouse cursor is over the
  rectangle of THE focused window, no widget under the cursor receives
  active (hover, click) events. Prevents being able to click "through"
  the window and interact with widgets and other windows below.
* Adds Close, Maximize and Minimize buttons to windows. Maximize is
  still buggy and Minimize is implementation-defined behavior with no
  default event handler configured.
* eg/windows has an example of the Window Manager for SDL2 and
  WebAssembly targets.
2020-04-08 17:29:04 -07:00

47 lines
949 B
HTML

<!DOCTYPE html>
<html>
<head>
<title>go/ui wasm demo</title>
<style>
#canvas {
position: fixed;
width: 100%;
height: 100%;
top: 0;
right: 0;
left: 0;
bottom: 0;
}
@font-face {
font-family: "DejaVuSans";
src: url("DejaVuSans.ttf") format("truetype");
}
</style>
</head>
<body>
<script src="wasm_exec.js"></script>
<script>
if (!WebAssembly.instantiateStreaming) { // polyfill
WebAssembly.instantiateStreaming = async (resp, importObject) => {
const source = await (await resp).arrayBuffer();
return await WebAssembly.instantiate(source, importObject);
};
}
(function() {
const go = new Go();
WebAssembly.instantiateStreaming(fetch("app.wasm"), go.importObject).then(result => {
console.clear();
go.run(result.instance);
WebAssembly.instantiate(result.module, go.importObject); // reset instance
})
})();
</script>
<canvas id="canvas"></canvas>
</body>
</html>