summaryrefslogtreecommitdiffstats
path: root/main.mjs
diff options
context:
space:
mode:
authorBrian Cully <bjc@spork.org>2025-08-07 11:40:05 -0400
committerBrian Cully <bjc@spork.org>2025-08-07 11:42:35 -0400
commitb2e411de770a437dbdf31408b877e2952759e57a (patch)
treeecb124526bca7c8aa1a6a48999188a393bce1c71 /main.mjs
downloadaddem-rust-wasm-b2e411de770a437dbdf31408b877e2952759e57a.tar.gz
addem-rust-wasm-b2e411de770a437dbdf31408b877e2952759e57a.zip
WORKING add test
Diffstat (limited to 'main.mjs')
-rw-r--r--main.mjs16
1 files changed, 16 insertions, 0 deletions
diff --git a/main.mjs b/main.mjs
new file mode 100644
index 0000000..086b876
--- /dev/null
+++ b/main.mjs
@@ -0,0 +1,16 @@
+import init from './pkg/addem.js';
+
+async function run() {
+ console.debug('run');
+ const foo = await init();
+ console.debug('init done', foo);
+ window.calculate = _ => {
+ console.debug('calc');
+ const inp1 = document.getElementById('number-input1').value;
+ const inp2 = document.getElementById('number-input2').value;
+ const res = foo.add(parseInt(inp1), parseInt(inp2));
+ document.getElementById('result').textContent = res;
+ }
+}
+
+document.addEventListener('DOMContentLoaded', run);