aboutsummaryrefslogtreecommitdiff
path: root/tmp/index.html
blob: b222149babee955111d631f0e489e75696869078 (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<script type="module">
 import * as api from "./api-wasm.js";

 WebAssembly
   .instantiateStreaming(fetch("add.wasm"), { env: api })
   .then(({instance: {exports}}) => {
     const added = exports.add(4, 5);
     console.log("Adding 4 and 5:", added);

     exports.persistInt(6);
     const persisted = exports.retrieveInt();
     console.log("Persisted number:", persisted);
   });
</script>