Skip to content

Instantly share code, notes, and snippets.

@cyantarek
Created August 12, 2020 01:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cyantarek/db3b187863be3fcb92fb2c8d71ad9c75 to your computer and use it in GitHub Desktop.
Save cyantarek/db3b187863be3fcb92fb2c8d71ad9c75 to your computer and use it in GitHub Desktop.
<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