Skip to content

Instantly share code, notes, and snippets.

@mscalora
Created April 3, 2021 11:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mscalora/e7790e8467856aaece3611f9cd656407 to your computer and use it in GitHub Desktop.
Save mscalora/e7790e8467856aaece3611f9cd656407 to your computer and use it in GitHub Desktop.
simplified ttd_dom_ready - does not support (old) IE
(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