Last active
July 3, 2017 17:21
-
-
Save pocketbird/39687aa0e0a00896c3c2d8d7964cbac1 to your computer and use it in GitHub Desktop.
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
// Check if the DOM is ready every 100ms. | |
// If it is, clear the interval and do | |
// what you need to do inside the if statement | |
var isTheDomReady = setInterval(function() { | |
if (document.readyState === 'complete') { | |
clearInterval(isTheDomReady); // document ready, clear interval | |
// Do your stuff here. | |
} | |
}, 100); | |
// ES6 | |
let isTheDomReady = setInterval(() => { | |
if (document.readyState === 'complete') { | |
clearInterval(isTheDomReady); // document ready, clear interval | |
// Do your stuff here. | |
} | |
}, 100); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment