summaryrefslogtreecommitdiffstats
path: root/main.mjs
diff options
context:
space:
mode:
authorBrian Cully <bjc@spork.org>2025-08-22 11:39:14 -0400
committerBrian Cully <bjc@spork.org>2025-08-22 11:39:14 -0400
commit40352318ad887ad0bab7c9a3d22695bbcbe9f738 (patch)
tree2d9822c1762cbc0852114149539abfa21185cc93 /main.mjs
parenta1c946b747325b4d7df778ebc70112338482f143 (diff)
downloadautomathon-40352318ad887ad0bab7c9a3d22695bbcbe9f738.tar.gz
automathon-40352318ad887ad0bab7c9a3d22695bbcbe9f738.zip
start hooking the web ui up to rust
Diffstat (limited to 'main.mjs')
-rw-r--r--main.mjs24
1 files changed, 12 insertions, 12 deletions
diff --git a/main.mjs b/main.mjs
index 63f277e..2df434f 100644
--- a/main.mjs
+++ b/main.mjs
@@ -1,22 +1,22 @@
import init from './pkg/automathon.js';
async function loaded() {
- console.debug('run');
+ console.debug('running init');
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');
+ document.querySelector("#compile").onclick = e => {
+ console.debug("compile clicked", e);
+ mod.compile();
+ };
+ document.querySelector("#tick").onclick = e => {
+ console.debug("tick clicked", e);
+ mod.tick();
+ };
+ document.querySelector("#run").onclick = e => {
+ console.debug("run clicked", e);
mod.run();
- }
+ };
}
document.addEventListener('DOMContentLoaded', loaded);