Created
April 3, 2021 11:35
-
-
Save mscalora/e7790e8467856aaece3611f9cd656407 to your computer and use it in GitHub Desktop.
simplified ttd_dom_ready - does not support (old) IE
This file contains 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
(function (){ | |
window.ttd_dom_ready = window.ttd_dom_ready || function (cb) { | |
if (document.readyState === "complete" || | |
(document.readyState !== "loading" && !document.documentElement.doScroll)) { | |
cb(); | |
} else { | |
let mcb = () => { | |
document.removeEventListener("DOMContentLoaded", mcb); | |
cb(); | |
}; | |
document.addEventListener("DOMContentLoaded", mcb); | |
} | |
} | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment