cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jeffheif...@apache.org
Subject js commit: [CB-4942] [BlackBerry10] deviceready is never fired - Fix typo event.toLowerCase to type.type.toLowerCase - Added eventListener for webworksReady to allow nativeReady to fire
Date Mon, 30 Sep 2013 18:26:40 GMT
Updated Branches:
  refs/heads/3.1.x 8c1ba66e2 -> 07a50463e


[CB-4942] [BlackBerry10]  deviceready is never fired
    - Fix typo event.toLowerCase to type.type.toLowerCase
    - Added eventListener for webworksReady to allow nativeReady to fire

    Reviewed By: Jeffrey Heifetz <jheifetz@blackberry.com>
    Tested By: Tracy Li <tli@blackberry.com>


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

Branch: refs/heads/3.1.x
Commit: 07a50463e364daf9066c7d7e3ae033850f3e6db4
Parents: 8c1ba66
Author: Carlos Santana <csantana23@gmail.com>
Authored: Fri Sep 27 21:38:53 2013 -0400
Committer: Jeffrey Heifetz <jheifetz@blackberry.com>
Committed: Mon Sep 30 14:24:52 2013 -0400

----------------------------------------------------------------------
 lib/blackberry10/platform.js | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/07a50463/lib/blackberry10/platform.js
----------------------------------------------------------------------
diff --git a/lib/blackberry10/platform.js b/lib/blackberry10/platform.js
index 73a322f..99f1cb1 100644
--- a/lib/blackberry10/platform.js
+++ b/lib/blackberry10/platform.js
@@ -37,18 +37,25 @@ module.exports = {
                 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 (event.toLowerCase() === 'webworksready') {
+                if (type.toLowerCase() === 'webworksready') {
                     listenerRegistered = true;
                     fireWebworksReadyEvent();
                 }
             }
         };
 
+        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;
@@ -57,7 +64,6 @@ module.exports = {
                 evt = document.createEvent('Events');
                 evt.initEvent('webworksready', true, true);
                 document.dispatchEvent(evt);
-                channel.onNativeReady.fire();
             }
         }
 


Mime
View raw message