added support for ses.request(method, param1, param2, ...) style requests
authorerickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Thu, 6 Mar 2008 19:32:07 +0000 (19:32 +0000)
committererickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Thu, 6 Mar 2008 19:32:07 +0000 (19:32 +0000)
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1259 9efc2488-bf62-4759-914b-345cdb29e865

src/javascript/opensrf.js

index 6f93379..e52c145 100644 (file)
@@ -108,9 +108,21 @@ OpenSRF.set_subclass('OpenSRF.ClientSession', 'OpenSRF.Session');
 
 
 OpenSRF.ClientSession.prototype.request = function(args) {
+
+    if(typeof args == 'string') { 
+        params = [];
+        for(var i = 1; i < arguments.length; i++)
+            params.push(arguments[i]);
+
+        args = {
+            method : args, 
+            params : params
+        };
+    }
+
     var req = new OpenSRF.Request(this, this.last_id++, args);
     this.requests.push(req);
-    req.send();
+    return req;
 }
 
 OpenSRF.ClientSession.prototype.find_request = function(reqid) {