Skip to content

Instantly share code, notes, and snippets.

@StyxOfDynamite
Forked from olemak/ready.js
Created October 16, 2017 19:53
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 StyxOfDynamite/d09440093bd6d33dda81211d6d39b1b5 to your computer and use it in GitHub Desktop.
Save StyxOfDynamite/d09440093bd6d33dda81211d6d39b1b5 to your computer and use it in GitHub Desktop.
`JavaScript (ES2015) native "on document ready"
(() => { function fn() {
// "On document ready" commands:
console.log(document.readyState);
};
if (document.readyState != 'loading') {fn()}
else {document.addEventListener('DOMContentLoaded', fn)}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment