diff options
Diffstat (limited to 'main.mjs')
| -rw-r--r-- | main.mjs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/main.mjs b/main.mjs new file mode 100644 index 0000000..63f277e --- /dev/null +++ b/main.mjs @@ -0,0 +1,22 @@ +import init from './pkg/automathon.js'; + +async function loaded() { + console.debug('run'); + const mod = await init(); + console.debug('init done', mod); + + window.calculate = _ => { + console.debug('calc'); + const inp1 = document.getElementById('number-input1').value; + const inp2 = document.getElementById('number-input2').value; + const res = mod.add(parseInt(inp1), parseInt(inp2)); + document.getElementById('result').textContent = res; + } + + window.testalert = _ => { + console.debug('testalert'); + mod.run(); + } +} + +document.addEventListener('DOMContentLoaded', loaded); |
