Skip to content

Commit

Permalink
feat(platform): warn on lack of deviceready. Fixes #4723
Browse files Browse the repository at this point in the history
  • Loading branch information
mlynch committed Dec 6, 2015
1 parent 762bfa7 commit 128bb78
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion js/utils/platform.js
Expand Up @@ -393,7 +393,21 @@
var platformName = null, // just the name, like iOS or Android
platformVersion = null, // a float of the major and minor, like 7.1
readyCallbacks = [],
windowLoadListenderAttached;
windowLoadListenderAttached,
platformReadyTimer = 2000; // How long to wait for platform ready before emitting a warning

verifyPlatformReady();

// Warn the user if deviceready did not fire in a reasonable amount of time, and how to fix it.
function verifyPlatformReady() {
setTimeout(function() {
if(!self.isReady) {
console.warn('Possible issue: deviceready did not fire in a reasonable amount of time. ' +
'This can be caused by plugins in an inconsistent state. One possible solution: uninstall/remove all ' +
'plugins and reinstall them. Additionally, one or more plugins might be faulty or out of date.');
}
}, platformReadyTimer);
}

// setup listeners to know when the device is ready to go
function onWindowLoad() {
Expand Down

0 comments on commit 128bb78

Please sign in to comment.