diff --git a/TODO b/TODO index 25f14a3..400cb82 100644 --- a/TODO +++ b/TODO @@ -1,9 +1,5 @@ -- arithmatic +- finish event listener: -- path to event listener: - - - rerender w/ a signal to branch into handler - - capture correct position information in script blocks - card fields (vars maybe not needed yet?) - set field command - buffer output/side-effects in VM @@ -11,6 +7,11 @@ - unit test - command - set field inline instead of separate data??? + - capture correct position information in script blocks + +- arithmatic + +- if blocks - impl vars diff --git a/src/3x5.ts b/src/3x5.ts index 3ee6081..3934999 100644 --- a/src/3x5.ts +++ b/src/3x5.ts @@ -50,7 +50,9 @@ fieldInput.value = String.raw` title "Hello, World!" `.trim(); -const codeInput = document.createElement("textarea"); +const codeInput = Object.assign(document.createElement("textarea"), { + oninput: render, +}); Object.assign(codeInput.style, TEXTAREA_STYLE, { height: "20em" }); codeInput.value = String.raw` h1 [get title] @@ -99,10 +101,6 @@ para { } `.trim(); -const rerender = Object.assign(document.createElement("button"), { - onclick: () => render(), - textContent: "Render", -}); const state = document.createElement("pre"); const display = document.createElement("blockquote"); const debugDisplay = document.createElement("pre"); @@ -164,14 +162,7 @@ function triggerEvent(handlerPos: number) { } render(); -document.body.append( - fieldInput, - codeInput, - rerender, - display, - state, - debugDisplay -); +document.body.append(fieldInput, codeInput, display, state, debugDisplay); RegisterJumpHere(codeInput); RegisterButtonOnClick(triggerEvent);