From 2eecdb1a4bae0fbced05f4c375cd6126929fb1fb Mon Sep 17 00:00:00 2001 From: Brian Cully Date: Thu, 7 Aug 2025 14:16:43 -0400 Subject: parser now emits list of words and hashmap of string→index MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit wordlist is just a vector of bytecode entries. to associate a word to an entry in the wordlist, use the word catalog to look up by name. --- main.mjs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 main.mjs (limited to 'main.mjs') 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); -- cgit v1.3