restore document-ready dep (#454)

This commit is contained in:
Yoshua Wuyts
2017-03-30 12:20:57 +02:00
committed by GitHub
parent d389fd507a
commit 2bbcb53f4a
3 changed files with 2 additions and 17 deletions
-16
View File
@@ -1,16 +0,0 @@
var assert = require('assert')
module.exports = documentReady
function documentReady (callback) {
assert.notEqual(typeof document, 'undefined', 'document-ready only runs in the browser')
var state = document.readyState
if (state === 'complete' || state === 'interactive') {
return setTimeout(callback, 0)
}
document.addEventListener('DOMContentLoaded', function onLoad () {
callback()
})
}