changeset 1625:bd34a4af516a

Change client-side debug to use console.debug
author Adam Chlipala <adam@chlipala.net>
date Sat, 03 Dec 2011 16:25:09 -0500
parents f96e708b4b93
children 07eed8386f07
files lib/js/urweb.js src/settings.sml tests/csdebug.ur
diffstat 3 files changed, 17 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lib/js/urweb.js	Sat Dec 03 16:05:06 2011 -0500
+++ b/lib/js/urweb.js	Sat Dec 03 16:25:09 2011 -0500
@@ -338,6 +338,16 @@
 
 // Error handling
 
+function uw_debug(msg) {
+    try {
+        console.debug(msg);
+    } catch (e) {
+        alert("DEBUG: " + msg);
+    }
+
+    return 0;
+}
+
 function whine(msg) {
     alert(msg);
     throw msg;
--- a/src/settings.sml	Sat Dec 03 16:05:06 2011 -0500
+++ b/src/settings.sml	Sat Dec 03 16:25:09 2011 -0500
@@ -270,8 +270,8 @@
                           ("lt_time", "lt"),
                           ("le_time", "le"),
 
-                          ("debug", "alert"),
-                          ("naughtyDebug", "alert"),
+                          ("debug", "uw_debug"),
+                          ("naughtyDebug", "uw_debug"),
 
                           ("floatFromInt", "float"),
                           ("ceil", "ceil"),
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/csdebug.ur	Sat Dec 03 16:25:09 2011 -0500
@@ -0,0 +1,5 @@
+fun main () : transaction page =
+    n <- source 0;
+    return <xml><body>
+      <button onclick={n' <- get n; set n (n' + 1); debug ("Message: " ^ show n')}/>
+    </body></xml>