summaryrefslogtreecommitdiffstats
path: root/main.mjs
diff options
context:
space:
mode:
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);