incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From deedu...@apache.org
Subject js commit: [CB-840] Call handler if deviceready has already fired.
Date Wed, 30 May 2012 13:52:06 GMT
Updated Branches:
  refs/heads/master eab1ae45c -> 8d7264291


[CB-840] Call handler if deviceready has already fired.


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/8d726429
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/8d726429
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/8d726429

Branch: refs/heads/master
Commit: 8d726429194313392534f7a7d0063bd2ecc0c011
Parents: eab1ae4
Author: Drew Walters <deedubbu@gmail.com>
Authored: Wed May 30 08:50:50 2012 -0500
Committer: Drew Walters <deedubbu@gmail.com>
Committed: Wed May 30 08:50:50 2012 -0500

----------------------------------------------------------------------
 lib/cordova.js |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/8d726429/lib/cordova.js
----------------------------------------------------------------------
diff --git a/lib/cordova.js b/lib/cordova.js
index 852951a..5eedc3a 100644
--- a/lib/cordova.js
+++ b/lib/cordova.js
@@ -28,7 +28,11 @@ var documentEventHandlers = {},
 document.addEventListener = function(evt, handler, capture) {
     var e = evt.toLowerCase();
     if (typeof documentEventHandlers[e] != 'undefined') {
-        documentEventHandlers[e].subscribe(handler);
+        if (evt === 'deviceready') {
+            documentEventHandlers[e].subscribeOnce(handler);
+        } else {
+            documentEventHandlers[e].subscribe(handler);
+        }
     } else {
         m_document_addEventListener.call(document, evt, handler, capture);
     }


Mime
View raw message