Commit db91ee36 authored by Richard Musiol's avatar Richard Musiol Committed by Brad Fitzpatrick

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/112980Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: default avatarAgniva De Sarker <agniva.quicksilver@gmail.com>
parent 3027932a
...@@ -17,14 +17,14 @@ license that can be found in the LICENSE file. ...@@ -17,14 +17,14 @@ license that can be found in the LICENSE file.
async function loadAndCompile() { async function loadAndCompile() {
let resp = await fetch("test.wasm"); let resp = await fetch("test.wasm");
let bytes = await resp.arrayBuffer(); let bytes = await resp.arrayBuffer();
await compile(bytes); await go.compile(bytes);
document.getElementById("runButton").disabled = false; document.getElementById("runButton").disabled = false;
} }
loadAndCompile(); loadAndCompile();
</script> </script>
<button onClick="console.clear(); run();" id="runButton" disabled>Run</button> <button onClick="console.clear(); go.run();" id="runButton" disabled>Run</button>
</body> </body>
</html> </html>
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment