Skip to content

Commit 128bb78

Browse files
committed
feat(platform): warn on lack of deviceready. Fixes #4723
1 parent 762bfa7 commit 128bb78

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

Diff for: js/utils/platform.js

+15-1
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,21 @@
393393
var platformName = null, // just the name, like iOS or Android
394394
platformVersion = null, // a float of the major and minor, like 7.1
395395
readyCallbacks = [],
396-
windowLoadListenderAttached;
396+
windowLoadListenderAttached,
397+
platformReadyTimer = 2000; // How long to wait for platform ready before emitting a warning
398+
399+
verifyPlatformReady();
400+
401+
// Warn the user if deviceready did not fire in a reasonable amount of time, and how to fix it.
402+
function verifyPlatformReady() {
403+
setTimeout(function() {
404+
if(!self.isReady) {
405+
console.warn('Possible issue: deviceready did not fire in a reasonable amount of time. ' +
406+
'This can be caused by plugins in an inconsistent state. One possible solution: uninstall/remove all ' +
407+
'plugins and reinstall them. Additionally, one or more plugins might be faulty or out of date.');
408+
}
409+
}, platformReadyTimer);
410+
}
397411

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

0 commit comments

Comments
 (0)