Mercurial > urweb
annotate tests/updateErr.ur @ 1836:276fa06428ba
Ignore polymorphism in JavaScript calls to custom FFI functions, allowing a kind of simple dynamic typing (unsafe, of course)
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Tue, 11 Dec 2012 15:58:23 -0500 |
parents | 7c6b6c3c7b79 |
children | abb0e95dcaa1 |
rev | line source |
---|---|
adamc@729 | 1 fun main () : transaction page = |
adamc@729 | 2 s <- source ""; |
adamc@729 | 3 b <- Buffer.create; |
adamc@729 | 4 txt <- source ""; |
adamc@729 | 5 |
adamc@729 | 6 return <xml><body onload={onError (fn xml => Buffer.write b (show xml)); |
adamc@729 | 7 onFail (fn s => alert ("FAIL! " ^ s))}> |
adamc@729 | 8 <dyn signal={s <- signal s; return <xml>{[s]}</xml>}/><br/> |
adamc@729 | 9 <dyn signal={s <- signal s; if s = "" then return <xml>Init</xml> else error <xml>Crapky</xml>}/><br/> |
adamc@729 | 10 <dyn signal={s <- signal s; return <xml>"{[s]}"</xml>}/><br/> |
adamc@729 | 11 |
adamc@729 | 12 <ctextbox source={txt}/> <button onclick={s' <- get txt; set s s'; set txt ""}/> |
adamc@729 | 13 |
adamc@729 | 14 <hr/> |
adamc@729 | 15 |
adamc@729 | 16 <dyn signal={Buffer.render b}/> |
adamc@729 | 17 </body></xml> |