]> git.pond.sub.org Git - eow/blobdiff - static/eow.js
Forward prompt to browser
[eow] / static / eow.js
index 00b34ee239e46328344d35e3fbf85a4f097b524e..55fb20c134b5db38691cbeaaf3d57ee7d4113724 100644 (file)
@@ -5,14 +5,14 @@ function eowOut(output) {
   dojo.byId("output").appendChild(p);
 }
 
-function hello() {
+function get_next_update() {
   dojo.xhrGet( {
     // The following URL must match that used to test the server.
     url: "/eow/update", 
     handleAs: "javascript",
     //handleAs: "text",
 
-    timeout: 5000, // Time in milliseconds
+    timeout: 30000, // Time in milliseconds
 
     // The LOAD function will be called on a successful response.
     load: function(response, ioArgs) {
@@ -22,9 +22,19 @@ function hello() {
 
     // The ERROR function will be called in an error case.
     error: function(response, ioArgs) {
-      console.error("HTTP status code: ", ioArgs.xhr.status);
-      return response;
+       if (response.dojoType == "timeout") {
+         ioArgs.xhr.abort();
+         get_next_update();
+         return response;
+       }
+
+       console.error("HTTP status code: ", ioArgs.xhr.status);
+       return response;
     }
   });
 }
 
+function prompt(minutes, btus) {
+  eowOut("[" + minutes + "," + btus + "]: ");
+  get_next_update();
+}