You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by de...@apache.org on 2012/05/30 15:52:06 UTC
js commit: [CB-840] Call handler if deviceready has already fired.
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 <de...@gmail.com>
Authored: Wed May 30 08:50:50 2012 -0500
Committer: Drew Walters <de...@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);
}