1
0
Fork 0
management/front/dkha-web-sz-main/node_modules/domready/ready.js

31 lines
804 B
JavaScript
Raw Permalink Normal View History

2023-12-18 13:12:25 +08:00
/*!
* domready (c) Dustin Diaz 2014 - License MIT
*/
!function (name, definition) {
if (typeof module != 'undefined') module.exports = definition()
else if (typeof define == 'function' && typeof define.amd == 'object') define(definition)
else this[name] = definition()
}('domready', function () {
var fns = [], listener
, doc = document
, hack = doc.documentElement.doScroll
, domContentLoaded = 'DOMContentLoaded'
, loaded = (hack ? /^loaded|^c/ : /^loaded|^i|^c/).test(doc.readyState)
if (!loaded)
doc.addEventListener(domContentLoaded, listener = function () {
doc.removeEventListener(domContentLoaded, listener)
loaded = 1
while (listener = fns.shift()) listener()
})
return function (fn) {
loaded ? setTimeout(fn, 0) : fns.push(fn)
}
});