Last active
May 11, 2016 01:51
-
-
Save tvler/8fd53d11ed775ebc72419bb5d96b8696 to your computer and use it in GitHub Desktop.
A way to call a JavaScript function on DOMContentLoaded or after, no rush. Great for non-essential async code.
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
var test = () => { | |
console.log('fired on DOMContentLoaded or after'); | |
} | |
window.onwheneva = test; | |
document.readyState !== 'loading' ? onwheneva() : | |
document.addEventListener('DOMContentLoaded', onwheneva); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment