You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by lo...@apache.org on 2013/05/07 17:14:14 UTC

[27/50] [abbrv] webworks commit: Updating PluginResult to add a getter for the callbackId.

Updating PluginResult to add a getter for the callbackId.

Reviewed by Bryan Higgins <bh...@blackberry.com>


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

Branch: refs/heads/future
Commit: 860544e08a5a8543e4ec8553c5df84f314d86e7d
Parents: 0d59102
Author: Jeffrey Heifetz <jh...@rim.com>
Authored: Thu Apr 4 13:42:34 2013 -0400
Committer: Bryan Higgins <bh...@blackberry.com>
Committed: Fri May 3 10:13:30 2013 -0400

----------------------------------------------------------------------
 blackberry10/framework/lib/PluginResult.js |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/860544e0/blackberry10/framework/lib/PluginResult.js
----------------------------------------------------------------------
diff --git a/blackberry10/framework/lib/PluginResult.js b/blackberry10/framework/lib/PluginResult.js
index 7cae945..c3e999c 100644
--- a/blackberry10/framework/lib/PluginResult.js
+++ b/blackberry10/framework/lib/PluginResult.js
@@ -19,15 +19,18 @@ function PluginResult (args, env) {
     var CALLBACK_STATUS_NO_RESULT = 0,
         CALLBACK_STATUS_OK = 1,
         CALLBACK_STATUS_ERROR = 9,
+        callbackId = JSON.parse(decodeURIComponent(args.callbackId)),
         send = function (data) {
             env.response.send(200, encodeURIComponent(JSON.stringify(data)));
         },
         callback = function (success, status, data, keepCallback) {
-            var executeString = "cordova.callbackFromNative(" + decodeURIComponent(args.callbackId) +
-                ", " + !!success + ", " + status + ", " + data + ", " + !!keepCallback + ");";
+            var executeString = "cordova.callbackFromNative('" + callbackId  + "', " +
+                !!success + ", " + status + ", " + data + ", " + !!keepCallback + ");";
             env.webview.executeJavaScript(executeString);
         };
 
+    Object.defineProperty(this, "callbackId", {enumerable: true, value: callbackId});
+
     this.noResult = function (keepCallback) {
         send({ code: CALLBACK_STATUS_NO_RESULT, keepCallback: !!keepCallback });
     };