Created
August 12, 2015 02:47
-
-
Save lili21/1cb8a53c6d97899bbf1b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
HTMLDocument.prototype.ready = function () { | |
return new Promise(function(resolve, reject) { | |
if (document.readyState === 'complete') { | |
resolve(document) | |
} else { | |
document.addEventListener('DOMContentLoaded', function() { | |
resolve(document) | |
}); | |
} | |
}); | |
} | |
document.ready().then(...) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment