summaryrefslogtreecommitdiffstats
path: root/main.mjs
blob: c07dccd74df0d76a78f1d68e3cad9c80fa64b975 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import init, { compile, run, tick } from './pkg/automathon.js';

async function loaded() {
    console.debug('running init');
    const mod = await init();
    console.debug('init done', mod);

    document.querySelector('#compile').onclick = e => {
        console.debug('compile clicked', e);
        let text = document.querySelector('textarea').textContent;
        compile(text);
    };
    document.querySelector('#tick').onclick = e => {
        console.debug('tick clicked', e);
        tick();
    };
    document.querySelector('#run').onclick = e => {
        console.debug('run clicked', e);
        run();
    };
}

document.addEventListener('DOMContentLoaded', loaded);