git @ Cat's Eye Technologies Emmental / 6be2485
Clear the output element before running the program. Chris Pressey 5 years ago
1 changed file(s) with 4 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
1414 putCh :: Char -> IO ()
1515 putCh = ffi "(function(c) {var o=document.getElementById('prog-output'); o.textContent += String.fromCharCode(c);})"
1616
17 clearOutput :: IO ()
18 clearOutput = ffi "(function(c) {var o=document.getElementById('prog-output'); o.textContent = '';})"
19
1720 main = withElems ["prog", "result", "run-button"] driver
1821
1922 driver [progElem, resultElem, runButtonElem] =
2023 onEvent runButtonElem Click $ \_ -> do
2124 Just prog <- getValue progElem
25 clearOutput
2226 r <- emmentalWithIO (getCh) (putCh) prog
2327 setProp resultElem "textContent" $ show $ r