From 60482e35674bc5fc1339d8c89b6f1b2e110737a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Madeleine=20Sydney=20=C5=9Alaga?= Date: Tue, 14 Jul 2026 17:28:13 -0600 Subject: [PATCH] example cont stack wat --- index.html | 20 ++++++++++++++ t.js | 18 +++++++++++++ u.wasm | Bin 0 -> 384 bytes u.wat | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++--- 4 files changed, 112 insertions(+), 3 deletions(-) create mode 100644 index.html create mode 100644 t.js create mode 100644 u.wasm diff --git a/index.html b/index.html new file mode 100644 index 0000000..06a376a --- /dev/null +++ b/index.html @@ -0,0 +1,20 @@ + + + + + + + diff --git a/t.js b/t.js new file mode 100644 index 0000000..a3d8ac2 --- /dev/null +++ b/t.js @@ -0,0 +1,18 @@ +const imports = { + guppy: { + print: (arg) => console.log (arg) + } +} + +// Assume add.wasm file exists that contains a single function adding 2 provided arguments +const fs = require('node:fs'); + +// Use the readFileSync function to read the contents of the "add.wasm" file +const wasmBuffer = fs.readFileSync('u.wasm'); + +// Use the WebAssembly.instantiate method to instantiate the WebAssembly module +WebAssembly.instantiate(wasmBuffer, imports).then(wasmModule => { + // Exported function lives under instance.exports object + const { main } = wasmModule.instance.exports; + main () +}); diff --git a/u.wasm b/u.wasm new file mode 100644 index 0000000000000000000000000000000000000000..702623c133f40f35bb0d4f951a20fd744ac53409 GIT binary patch literal 384 zcmZQbEY4+QU|?Y6XGvhJXNXH?V2sOUOkiMO;%8({FD)pjWGyJl%qwAFU}j+k5iE=a z3`}g2%qffvjtz{z*%`U(866q8Q@FN zA|p#)Vs0v