mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
For mobile autoupdate wait for both events to happen:
(deviceready, DOMContentLoaded) Use the fixed cordova-update
This commit is contained in:
@@ -68,5 +68,5 @@ Package.on_use(function(api) {
|
||||
|
||||
Cordova.depends({
|
||||
'org.apache.cordova.device': '0.2.11',
|
||||
'com.meteor.cordova-update': 'https://github.com/meteor/com.meteor.cordova-update/tarball/587af6eb67f8f3994309e17a90e8694b93ad47fe'
|
||||
'com.meteor.cordova-update': 'https://github.com/meteor/com.meteor.cordova-update/tarball/31640d593ac99012cd7670295ebbec40ffa7f3f0'
|
||||
});
|
||||
|
||||
@@ -2,15 +2,25 @@ var queue = [];
|
||||
var loaded = !Meteor.isCordova &&
|
||||
(document.readyState === "loaded" || document.readyState == "complete");
|
||||
|
||||
var awaitingEventsCount = 1;
|
||||
var ready = function() {
|
||||
awaitingEventsCount--;
|
||||
if (awaitingEventsCount > 0)
|
||||
return;
|
||||
|
||||
loaded = true;
|
||||
while (queue.length)
|
||||
(queue.shift())();
|
||||
};
|
||||
|
||||
if (document.addEventListener) {
|
||||
var event = Meteor.isCordova ? 'deviceready' : 'DOMContentLoaded';
|
||||
document.addEventListener(event, ready, false);
|
||||
document.addEventListener('DOMContentLoaded', ready, false);
|
||||
|
||||
if (Meteor.isCordova) {
|
||||
awaitingEventsCount++;
|
||||
document.addEventListener('deviceready', ready, false);
|
||||
}
|
||||
|
||||
window.addEventListener('load', ready, false);
|
||||
} else {
|
||||
document.attachEvent('onreadystatechange', function () {
|
||||
|
||||
Reference in New Issue
Block a user