1234567891011121314151617181920 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>WASM test</title>
- </head>
- <body>
- <script type="module">
- (async() => {
- const response = await fetch('add.wasm');
- const bytes = await response.arrayBuffer();
- const { instance } = await WebAssembly.instantiate(bytes);
- console.log('The answer is: ' + instance.exports.add(1, 2));
- })();
- </script>
- </body>
- </html>
|