diff tests/updateErr.ur @ 729:7c6b6c3c7b79

Some client-side error handling
author Adam Chlipala <adamc@hcoop.net>
date Thu, 16 Apr 2009 13:47:20 -0400
parents
children abb0e95dcaa1
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/updateErr.ur	Thu Apr 16 13:47:20 2009 -0400
@@ -0,0 +1,17 @@
+fun main () : transaction page =
+    s <- source "";
+    b <- Buffer.create;
+    txt <- source "";
+
+    return <xml><body onload={onError (fn xml => Buffer.write b (show xml));
+                              onFail (fn s => alert ("FAIL! " ^ s))}>
+      <dyn signal={s <- signal s; return <xml>{[s]}</xml>}/><br/>
+      <dyn signal={s <- signal s; if s = "" then return <xml>Init</xml> else error <xml>Crapky</xml>}/><br/>
+      <dyn signal={s <- signal s; return <xml>"{[s]}"</xml>}/><br/>
+
+      <ctextbox source={txt}/> <button onclick={s' <- get txt; set s s'; set txt ""}/>
+
+      <hr/>
+
+      <dyn signal={Buffer.render b}/>
+    </body></xml>