[rhmessaging-commits] rhmessaging commits: r3164 - mgmt/trunk/wooly/resources.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Wed Mar 18 14:09:08 EDT 2009


Author: eallen
Date: 2009-03-18 14:09:07 -0400 (Wed, 18 Mar 2009)
New Revision: 3164

Modified:
   mgmt/trunk/wooly/resources/wooly.js
Log:
Adding directUpdate to pass raw responseXML back to callback function.

Modified: mgmt/trunk/wooly/resources/wooly.js
===================================================================
--- mgmt/trunk/wooly/resources/wooly.js	2009-03-18 17:56:42 UTC (rev 3163)
+++ mgmt/trunk/wooly/resources/wooly.js	2009-03-18 18:09:07 UTC (rev 3164)
@@ -307,7 +307,40 @@
         this.updatePage = updatePage
 
         this.updaterIDs = [];
+  
+        // pass the responseXML directly back to function 
+        this.directUpdate = function(url, callback, interval, passback) {
+            var req = this.getNewRequest();
 
+            function fetch() {
+                req.open("get", url, true);
+                req.onreadystatechange = update;
+                req.send(null);
+            }
+
+            if (interval > 0) {
+                var id = window.setInterval(fetch, interval);
+                this.updater_ids.push(id);
+            } 
+            fetch(); // send request immediately
+            
+            function update() {
+                try {
+                    if (req.readyState == 4 && req.status == 200) {
+                        callback(req.responseXML, passback);
+                    }
+                } catch (e) {
+                    log(e);
+                    throw e;
+                }
+            }
+        }
+
+        this.getNewRequest = getNewRequest
+        this.updatePage = updatePage
+
+        this.updaterIDs = [];
+
         this.deferredUpdate = function(url, callback, passback) {
             var req = this.getNewRequest();
 




More information about the rhmessaging-commits mailing list