added onNativeReady and onDOMContentLoaded events

This commit is contained in:
Dave Johnson
2010-07-22 13:05:41 -07:00
parent ca01781766
commit 8e5de2cb7b
4 changed files with 285 additions and 165 deletions
+1 -18
View File
@@ -56,21 +56,4 @@ Device.prototype.exitApp = function()
PhoneGap.addConstructor(function() {
navigator.device = window.device = new Device();
});
PhoneGap.onDeviceReady = new PhoneGap.Channel();
PhoneGap.__document_addEventListener = document.addEventListener;
document.addEventListener = function(evt, handler, capture) {
if (evt.toLowerCase() == 'deviceready') {
PhoneGap.onDeviceReady.sob(handler);
} else {
PhoneGap.__document_addEventListener.call(document, evt, handler);
}
}
document.addEventListener('DOMContentLoaded', function() {
PhoneGap.onDeviceReady.fire();
})
});