Skip to content

Instantly share code, notes, and snippets.

@AllThingsSmitty
Last active March 9, 2016 19:59
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save AllThingsSmitty/d8cdfb4ce38b534d2105 to your computer and use it in GitHub Desktop.
Save AllThingsSmitty/d8cdfb4ce38b534d2105 to your computer and use it in GitHub Desktop.
Using readyState to show document state
// credit: Louis Lazaris
document.onreadystatechange = function () {
switch (document.readyState) {
case 'loading':
console.log('loading...');
break;
case 'interactive':
console.log('DOM is ready...');
break;
case 'complete':
console.log('Document complete...');
break;
}
};
// https://jsbin.com/diyihu/edit?html,css,js,console,output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment