make sync-style the default for pcrud, use {async:true} to go async
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 2 Jan 2009 19:53:38 +0000 (19:53 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 2 Jan 2009 19:53:38 +0000 (19:53 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@11727 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/dojo/openils/PermaCrud.js

index f89ba3c..5c00106 100644 (file)
@@ -74,9 +74,12 @@ if(!dojo._hasResource["openils.PermaCrud"]) {
                 }
             );
 
+            if (!opts.async && !opts.timeout) req_hash.timeout = 10;
+
             var _pcrud = this;
             var req = this.session.request( req_hash );
 
+
             if (!req.onerror)
                 req.onerror = function (r) { throw js2JSON(r); };
 
@@ -85,6 +88,7 @@ if(!dojo._hasResource["openils.PermaCrud"]) {
 
             req.send();
 
+            if (req_hash.timeout) return req.result.content();
             return req;
         },
 
@@ -105,6 +109,8 @@ if(!dojo._hasResource["openils.PermaCrud"]) {
                 }
             );
 
+            if (!opts.async && !opts.timeout) req_hash.timeout = 10;
+
             var _pcrud = this;
             var req = this.session.request( req_hash );
 
@@ -116,6 +122,7 @@ if(!dojo._hasResource["openils.PermaCrud"]) {
 
             req.send();
 
+            if (req_hash.timeout) return req.result.content();
             return req;
         },
 
@@ -131,6 +138,8 @@ if(!dojo._hasResource["openils.PermaCrud"]) {
                 }
             );
 
+            if (!opts.async && !opts.timeout) req_hash.timeout = 10;
+
             var _pcrud = this;
             var req = this.session.request( req_hash );
 
@@ -142,6 +151,7 @@ if(!dojo._hasResource["openils.PermaCrud"]) {
 
             req.send();
 
+            if (req_hash.timeout) return req.result.content();
             return req;
         },