Created
January 5, 2021 10:11
-
-
Save ronaldgreeff/2f3b68c83a704ca37c892670c18d2603 to your computer and use it in GitHub Desktop.
docReady
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
const docReady = (fn) => { | |
document.readyState === 'complete' || document.readyState === 'interactive' ? setTimeout(fn, 1) : document.addEventListener('DOMContentLoaded', fn); | |
} | |
docReady(function() { | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment