Skip to content
Permalink
Browse files

play with a lightweight text-based UI rendered with WebAssembly

  • Loading branch information...
dmitshur committed Apr 18, 2019
1 parent bd3352e commit ca3de7f3cba2fbf45d61f7f3871a6dbcf79ad4b0
Showing with 824 additions and 0 deletions.
  1. +21 −0 255/_data/index.html
  2. +26 −0 255/_data/style.css
  3. +465 −0 255/_data/wasm_exec.js
  4. +87 −0 255/errorhandler.go
  5. +87 −0 255/frontend/content.go
  6. +32 −0 255/frontend/main.go
  7. +106 −0 255/main.go
@@ -0,0 +1,21 @@
<html>
<head>
<meta name="viewport" content="width=device-width">
<link href="/-/fonts/fonts.css" rel="stylesheet" type="text/css">
<link href="/-/style.css" rel="stylesheet" type="text/css">
<script src="/-/wasm_exec.js"></script>
<script>
if (!WebAssembly.instantiateStreaming) { // polyfill for Safari :/
WebAssembly.instantiateStreaming = async (resp, importObject) => {
const source = await (await resp).arrayBuffer();
return await WebAssembly.instantiate(source, importObject);
};
}
const go = new Go();
WebAssembly.instantiateStreaming(fetch("/-/main.wasm"), go.importObject).then((result) => {
go.run(result.instance);
});
</script>
</head>
<body></body>
</html>
@@ -0,0 +1,26 @@
body {
font-family: "Go Mono";
font-size: 12px;
color: #333;

margin-left: auto;
margin-right: auto;
width: 800px;
white-space: pre-wrap;
}
a {
text-decoration: none;
}
a:hover {
text-decoration: underline;
}

@media (prefers-color-scheme: dark) {
body {
color: #ddd;
background-color: #222;
}
a {
color: rgb(173, 216, 230);
}
}

0 comments on commit ca3de7f

Please sign in to comment.
You can’t perform that action at this time.