Merge branch 'master' of github.com:driftyco/ionic

This commit is contained in:
Perry Govier
2014-09-16 22:55:26 -05:00
2 changed files with 18 additions and 5 deletions

View File

@@ -1,7 +1,7 @@
(function(window, document, ionic) {
var readyCallbacks = [];
var isDomReady = false;
var isDomReady = document.readyState === 'complete' || document.readyState === 'interactive';
function domReady() {
isDomReady = true;
@@ -11,7 +11,10 @@
readyCallbacks = [];
document.removeEventListener('DOMContentLoaded', domReady);
}
document.addEventListener('DOMContentLoaded', domReady);
if (!isDomReady){
document.addEventListener('DOMContentLoaded', domReady);
}
// From the man himself, Mr. Paul Irish.
// The requestAnimationFrame polyfill
@@ -110,7 +113,7 @@
* @param {function} callback The function to be called.
*/
ready: function(cb) {
if(isDomReady || document.readyState === "complete") {
if(isDomReady) {
ionic.requestAnimationFrame(cb);
} else {
readyCallbacks.push(cb);

View File

@@ -351,7 +351,8 @@
var platformName = null, // just the name, like iOS or Android
platformVersion = null, // a float of the major and minor, like 7.1
readyCallbacks = [];
readyCallbacks = [],
windowLoadListenderAttached;
// setup listeners to know when the device is ready to go
function onWindowLoad() {
@@ -364,8 +365,17 @@
// cordova/phonegap object, so its just a browser, not a webview wrapped w/ cordova
onPlatformReady();
}
window.removeEventListener("load", onWindowLoad, false);
if (windowLoadListenderAttached){
window.removeEventListener("load", onWindowLoad, false);
}
}
if (document.readyState === 'complete') {
onWindowLoad();
} else {
windowLoadListenderAttached = true;
window.addEventListener("load", onWindowLoad, false);
}
window.addEventListener("load", onWindowLoad, false);
function onPlatformReady() {