cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhigg...@apache.org
Subject [2/3] webworks commit: Update JS snapshot to version 3.4.0
Date Tue, 11 Feb 2014 20:28:28 GMT
Update JS snapshot to version 3.4.0


Project: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/commit/dcb1e028
Tree: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/tree/dcb1e028
Diff: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/diff/dcb1e028

Branch: refs/heads/3.4.x
Commit: dcb1e02801251ad1b5707a99f42be83c6b04abc4
Parents: c678cbd
Author: Bryan Higgins <bhiggins@blackberry.com>
Authored: Tue Feb 11 09:31:38 2014 -0500
Committer: Bryan Higgins <bhiggins@blackberry.com>
Committed: Tue Feb 11 09:31:38 2014 -0500

----------------------------------------------------------------------
 blackberry10/javascript/cordova.blackberry10.js | 40 ++++++++++++++++++--
 1 file changed, 36 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/dcb1e028/blackberry10/javascript/cordova.blackberry10.js
----------------------------------------------------------------------
diff --git a/blackberry10/javascript/cordova.blackberry10.js b/blackberry10/javascript/cordova.blackberry10.js
index fd35cfb..59705e5 100644
--- a/blackberry10/javascript/cordova.blackberry10.js
+++ b/blackberry10/javascript/cordova.blackberry10.js
@@ -1,5 +1,5 @@
 // Platform: blackberry10
-// 3.4.0-rc1
+// 3.4.0
 /*
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements.  See the NOTICE file
@@ -19,7 +19,7 @@
  under the License.
 */
 ;(function() {
-var CORDOVA_JS_BUILD_LABEL = '3.4.0-rc1';
+var CORDOVA_JS_BUILD_LABEL = '3.4.0';
 // file: src/scripts/require.js
 
 /*jshint -W079 */
@@ -852,13 +852,24 @@ function RemoteFunctionCall(functionUri) {
 
         request.send(JSON.stringify(params));
     };
+
+    this.makeSyncCall = function () {
+        var requestUri = composeUri(),
+        request = createXhrRequest(requestUri, false),
+        response;
+        request.send(JSON.stringify(params));
+        response = JSON.parse(decodeURIComponent(request.responseText) || "null");
+        return response;
+    };
+
 }
 
-module.exports = function (success, fail, service, action, args) {
+module.exports = function (success, fail, service, action, args, sync) {
     var uri = service + "/" + action,
     request = new RemoteFunctionCall(uri),
     callbackId = service + cordova.callbackId++,
     proxy,
+    response,
     name,
     didSucceed;
 
@@ -883,7 +894,28 @@ module.exports = function (success, fail, service, action, args) {
             }
         }
 
-        request.makeAsyncCall();
+        if (sync !== undefined && !sync) {
+            request.makeAsyncCall();
+            return;
+        }
+
+        response = request.makeSyncCall();
+
+        if (response.code < 0) {
+            if (fail) {
+                fail(response.msg, response);
+            }
+            delete cordova.callbacks[callbackId];
+        } else {
+            didSucceed = response.code === cordova.callbackStatus.OK || response.code ===
cordova.callbackStatus.NO_RESULT;
+            cordova.callbackFromNative(
+                callbackId,
+                didSucceed,
+                response.code,
+                [ didSucceed ? response.data : response.msg ],
+                !!response.keepCallback
+            );
+        }
     }
 
 };


Mime
View raw message