Skip to content

Commit

Permalink
wasm wip
Browse files Browse the repository at this point in the history
  • Loading branch information
neelance committed Feb 10, 2018
1 parent 4a57978 commit 0f87113
Show file tree
Hide file tree
Showing 212 changed files with 14,897 additions and 533 deletions.
10 changes: 10 additions & 0 deletions misc/wasm/go_js_wasm_exec
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

exec node "$DIR/wasm_exec.js" "$@"
25 changes: 25 additions & 0 deletions misc/wasm/wasm_exec.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!doctype html>
<html>

<head>
<meta charset="utf-8">
<title>Go wasm</title>
</head>

<body>
<script src="wasm_exec.js"></script>
<script>
async function loadAndCompile() {
let resp = await fetch("test.wasm");
let bytes = await resp.arrayBuffer();
await compile(bytes);
document.getElementById("runButton").disabled = false;
}

loadAndCompile();
</script>

<button onClick="console.clear(); run();" id="runButton" disabled>Run</button>
</body>

</html>
Loading

0 comments on commit 0f87113

Please sign in to comment.