Created
January 10, 2018 17:27
-
-
Save MiguelCastillo/deba8c06df41cdefd6eb7a4a158472e2 to your computer and use it in GitHub Desktop.
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
const deferred = new Promise(function(resolve) { | |
if (document.readyState === 'complete' || document.readyState === 'interactive') { | |
resolve(); | |
} | |
else { | |
document.addEventListener('DOMContentLoaded', (/*evt*/) => resolve()); | |
} | |
}); | |
export default (fn) => deferred.then(fn); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment