Difference between revisions of "MediaWiki:Chameleon.js"

From Far Cry 6 Wiki
 
(Created page with "docReady(function() { }); function docReady(fn) { // see if DOM is already available if (document.readyState === 'complete' || document.readyState === 'interactive')...")

Revision as of 13:27, 3 January 2021

docReady(function() {

});

function docReady(fn) {
    // see if DOM is already available
    if (document.readyState === 'complete' || document.readyState === 'interactive') {
        // call on next available tick
        setTimeout(fn, 1);
    } else {
        document.addEventListener('DOMContentLoaded', fn);
    }
}