Created
August 12, 2020 01:29
-
-
Save cyantarek/db3b187863be3fcb92fb2c8d71ad9c75 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta charset="utf-8"/> | |
<script src="wasm_exec.js"></script> | |
<script> | |
const go = new Go(); | |
WebAssembly.instantiateStreaming(fetch("main.wasm"), go.importObject).then(async (result) => { | |
await go.run(result.instance); | |
}); | |
const welcomeMe = () => { | |
let name = document.getElementById("name").value | |
let msg = welcome(name) | |
alert(msg) | |
} | |
</script> | |
</head> | |
<body> | |
<input id="name" type="text"> | |
<button onclick="welcomeMe()">Say</button> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment