[Opensrf-commits] r1918 - trunk/src/javascript (miker)

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Feb 3 10:15:32 EST 2010


Author: miker
Date: 2010-02-03 10:15:30 -0500 (Wed, 03 Feb 2010)
New Revision: 1918

Modified:
   trunk/src/javascript/opensrf.js
Log:
add non-destructive methods for grabbing first and last responses on the response queue

Modified: trunk/src/javascript/opensrf.js
===================================================================
--- trunk/src/javascript/opensrf.js	2010-02-02 17:25:26 UTC (rev 1917)
+++ trunk/src/javascript/opensrf.js	2010-02-03 15:15:30 UTC (rev 1918)
@@ -195,6 +195,21 @@
     this.complete = false;
 }
 
+OpenSRF.Request.prototype.peek_last = function(timeout) {
+    if(this.response_queue.length > 0) {
+        var x = this.response_queue.pop();
+        this.response_queue.push(x);
+        return x;
+    }
+    return null;
+}
+
+OpenSRF.Request.prototype.peek = function(timeout) {
+    if(this.response_queue.length > 0)
+        return this.response_queue[0];
+    return null;
+}
+
 OpenSRF.Request.prototype.recv = function(timeout) {
     if(this.response_queue.length > 0)
         return this.response_queue.shift();



More information about the opensrf-commits mailing list