1
0
mirror of https://github.com/golang/go synced 2024-11-13 14:20:23 -07:00
go/misc/wasm/wasm_exec.html
Richard Musiol db91ee3651 misc/wasm: pollute global JS namespace less
This commit changes wasm_exec.js so it only puts the single
name "go" into the global namespace. Other names became private
or were turned into a property/method of "go".

Change-Id: I633829dfd3c06936f092c0a14b9978bf855e41fe
Reviewed-on: https://go-review.googlesource.com/112980
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Agniva De Sarker <agniva.quicksilver@gmail.com>
2018-05-15 14:15:07 +00:00

31 lines
642 B
HTML

<!doctype html>
<!--
Copyright 2018 The Go Authors. All rights reserved.
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file.
-->
<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 go.compile(bytes);
document.getElementById("runButton").disabled = false;
}
loadAndCompile();
</script>
<button onClick="console.clear(); go.run();" id="runButton" disabled>Run</button>
</body>
</html>