incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject js commit: On iOS, do not pre-process exec args on the JS side.
Date Sat, 28 Jul 2012 00:03:46 GMT
Updated Branches:
  refs/heads/master 163e0e74a -> 18e390f48


On iOS, do not pre-process exec args on the JS side.


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/commit/18e390f4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/18e390f4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/18e390f4

Branch: refs/heads/master
Commit: 18e390f482ee5b16a7b90745339d69ac20de6e37
Parents: 163e0e7
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Fri Jul 27 14:53:38 2012 -0400
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Fri Jul 27 19:56:00 2012 -0400

----------------------------------------------------------------------
 lib/ios/exec.js                  |   21 +--------------------
 lib/ios/plugin/ios/nativecomm.js |    7 ++++---
 2 files changed, 5 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/18e390f4/lib/ios/exec.js
----------------------------------------------------------------------
diff --git a/lib/ios/exec.js b/lib/ios/exec.js
index d3e4ec4..bf0e1dd 100644
--- a/lib/ios/exec.js
+++ b/lib/ios/exec.js
@@ -48,13 +48,6 @@ module.exports = function() {
         actionArgs = Array.prototype.splice.call(arguments, 1);
     }
 
-    // Start building the command object.
-    var command = {
-        className: service,
-        methodName: action,
-        "arguments": []
-    };
-
     // Register the callbacks and add the callbackId to the positional
     // arguments if given.
     if (successCallback || failCallback) {
@@ -62,20 +55,8 @@ module.exports = function() {
         cordova.callbacks[callbackId] =
             {success:successCallback, fail:failCallback};
     }
-    if (callbackId !== null) {
-        command["arguments"].push(callbackId);
-    }
 
-    for (var i = 0; i < actionArgs.length; ++i) {
-        var arg = actionArgs[i];
-        if (arg === undefined || arg === null) { // nulls are pushed to the args now (becomes
NSNull)
-            command["arguments"].push(arg);
-        } else if (typeof(arg) == 'object' && !(utils.isArray(arg))) {
-            command.options = arg;
-        } else {
-            command["arguments"].push(arg);
-        }
-    }
+    var command = [callbackId, service, action, actionArgs];
 
     // Stringify and queue the command. We stringify to command now to
     // effectively clone the command arguments in case they are mutated before

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/18e390f4/lib/ios/plugin/ios/nativecomm.js
----------------------------------------------------------------------
diff --git a/lib/ios/plugin/ios/nativecomm.js b/lib/ios/plugin/ios/nativecomm.js
index a584c2b..76d75e1 100644
--- a/lib/ios/plugin/ios/nativecomm.js
+++ b/lib/ios/plugin/ios/nativecomm.js
@@ -4,7 +4,8 @@ var cordova = require('cordova');
  * Called by native code to retrieve all queued commands and clear the queue.
  */
 module.exports = function() {
-  var json = JSON.stringify(cordova.commandQueue);
-  cordova.commandQueue = [];
+  // Each entry in commandQueue is a JSON string already.
+  var json = '[' + cordova.commandQueue.join(',') + ']';
+  cordova.commandQueue.length = 0;
   return json;
-};
\ No newline at end of file
+};


Mime
View raw message