Skip to content

Instantly share code, notes, and snippets.

@fvilches17
Created May 5, 2019 10:55
Show Gist options
  • Select an option

  • Save fvilches17/49c4a33e3cf7d5b8d56a819a6c81ff83 to your computer and use it in GitHub Desktop.

Select an option

Save fvilches17/49c4a33e3cf7d5b8d56a819a6c81ff83 to your computer and use it in GitHub Desktop.

Revisions

  1. fvilches17 created this gist May 5, 2019.
    7 changes: 7 additions & 0 deletions hello-wasm-app.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    async function handleGreetButtonClickEvent(event) {
    event.preventDefault();
    const { greet } = await import('../src/hello_world/pkg');
    greet(); //When greet() is called, .wasm will update the <h1> title in index.html
    }

    document.querySelector('#btn-greet').onclick = handleGreetButtonClickEvent;