Created
June 10, 2015 12:06
-
-
Save antonmedv/c89c19bf32705ad8c8a4 to your computer and use it in GitHub Desktop.
Async DOM Content Loaded
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Async DOM Content Loaded | |
*/ | |
function onAsyncDOMContentLoaded(callback) { | |
if (document.readyState == 'loading') { | |
document.addEventListener('DOMContentLoaded', callback); | |
} else { | |
callback(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment