cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhigg...@apache.org
Subject [2/2] js commit: CB-5253 remove webworksready event
Date Sun, 03 Nov 2013 13:42:00 GMT
CB-5253 remove webworksready event


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

Branch: refs/heads/master
Commit: 974027689bf8dd1935b9d05a841e74dcd7d86388
Parents: 6568e94
Author: Bryan Higgins <bryan@bryanhiggins.net>
Authored: Sun Nov 3 00:09:56 2013 -0400
Committer: Bryan Higgins <bryan@bryanhiggins.net>
Committed: Sun Nov 3 08:40:56 2013 -0500

----------------------------------------------------------------------
 lib/blackberry10/exec.js     |  4 ++--
 lib/blackberry10/platform.js | 50 ++++++++++-----------------------------
 2 files changed, 14 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/97402768/lib/blackberry10/exec.js
----------------------------------------------------------------------
diff --git a/lib/blackberry10/exec.js b/lib/blackberry10/exec.js
index 138aa64..d7d2cff 100644
--- a/lib/blackberry10/exec.js
+++ b/lib/blackberry10/exec.js
@@ -39,7 +39,7 @@ function RemoteFunctionCall(functionUri) {
         params[name] = encodeURIComponent(JSON.stringify(value));
     };
 
-    this.makeSyncCall = function (success, error) {
+    this.makeSyncCall = function () {
         var requestUri = composeUri(),
         request = createXhrRequest(requestUri, false),
         response;
@@ -82,7 +82,7 @@ module.exports = function (success, fail, service, action, args) {
         didSucceed = response.code === cordova.callbackStatus.OK || response.code === cordova.callbackStatus.NO_RESULT;
         cordova.callbackFromNative(
             callbackId,
-            success,
+            didSucceed,
             response.code,
             [ didSucceed ? response.data : response.msg ],
             !!response.keepCallback

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/97402768/lib/blackberry10/platform.js
----------------------------------------------------------------------
diff --git a/lib/blackberry10/platform.js b/lib/blackberry10/platform.js
index c450409..9fcbda0 100644
--- a/lib/blackberry10/platform.js
+++ b/lib/blackberry10/platform.js
@@ -25,52 +25,24 @@ module.exports = {
 
     bootstrap: function() {
 
-        var cordova = require('cordova'),
-            channel = require('cordova/channel'),
-            addDocumentEventListener = document.addEventListener,
-            webworksReady = false,
-            alreadyFired = false,
-            listenerRegistered = false;
+        var channel = require('cordova/channel'),
+            addEventListener = document.addEventListener;
 
-        //override to pass online/offline events to window
+        //ready as soon as the plugins are
+        channel.onPluginsReady.subscribe(function () {
+            channel.onNativeReady.fire();
+        });
+
+        //pass document online/offline event listeners to window
         document.addEventListener = function (type) {
             if (type === "online" || type === "offline") {
                 window.addEventListener.apply(window, arguments);
             } else {
-                addDocumentEventListener.apply(document, arguments);
-                //Trapping when users add listeners to the webworks ready event
-                //This way we can make sure not to fire the event before there is a listener
-                if (type.toLowerCase() === 'webworksready') {
-                    listenerRegistered = true;
-                    fireWebworksReadyEvent();
-                }
+                addEventListener.apply(document, arguments);
             }
         };
 
-        channel.onDOMContentLoaded.subscribe(function () {
-            document.addEventListener("webworksready", function () {
-                channel.onNativeReady.fire();
-            });
-        });
-
-        channel.onPluginsReady.subscribe(function () {
-            webworksReady = true;
-            fireWebworksReadyEvent();
-        });
-
-
-        //Only fire the webworks event when both webworks is ready and a listener is registered
-        function fireWebworksReadyEvent() {
-            var evt;
-            if (listenerRegistered && webworksReady && !alreadyFired) {
-                alreadyFired = true;
-                evt = document.createEvent('Events');
-                evt.initEvent('webworksready', true, true);
-                document.dispatchEvent(evt);
-            }
-        }
-
-        //map blackberry.event to document for backwards compatibility
+        //map blackberry.event to document
         if (!window.blackberry) {
             window.blackberry = {};
         }
@@ -79,5 +51,7 @@ module.exports = {
             addEventListener: document.addEventListener,
             removeEventListener: document.removeEventListener
         };
+
     }
+
 };


Mime
View raw message