Fix: Observe script
This commit is contained in:
@@ -28,7 +28,8 @@ export default class Resources extends Tool
|
||||
this.refresh();
|
||||
this._bindEvent();
|
||||
this._initCfg();
|
||||
this._observeScript();
|
||||
|
||||
util.ready(() => this._observeScript());
|
||||
}
|
||||
refresh()
|
||||
{
|
||||
|
||||
@@ -1364,7 +1364,7 @@ module.exports = (function ()
|
||||
|
||||
var each = _.each = (function ()
|
||||
{
|
||||
/* Iterates over elements of collection and invokes iteratee for each element.
|
||||
/* Iterate over elements of collection and invokes iteratee for each element.
|
||||
*
|
||||
* |Name |Type |Desc |
|
||||
* |--------|------------|------------------------------|
|
||||
@@ -5329,6 +5329,55 @@ module.exports = (function ()
|
||||
return exports;
|
||||
})();
|
||||
|
||||
/* ------------------------------ ready ------------------------------ */
|
||||
|
||||
_.ready = (function ()
|
||||
{
|
||||
/* Invoke callback when dom is ready, similar to jQuery ready.
|
||||
*
|
||||
* |Name|Type |Desc |
|
||||
* |----|--------|-----------------|
|
||||
* |fn |function|Callback function|
|
||||
*
|
||||
* ```javascript
|
||||
* ready(function ()
|
||||
* {
|
||||
* // It's safe to manipulate dom here.
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
|
||||
/* module
|
||||
* env: browser
|
||||
* test: browser
|
||||
*/
|
||||
|
||||
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;
|
||||
/* eslint-disable no-cond-assign */
|
||||
while (listener = fns.shift()) listener();
|
||||
});
|
||||
}
|
||||
|
||||
function exports(fn)
|
||||
{
|
||||
loaded ? setTimeout(fn, 0) : fns.push(fn)
|
||||
}
|
||||
|
||||
return exports;
|
||||
})();
|
||||
|
||||
/* ------------------------------ rtrim ------------------------------ */
|
||||
|
||||
var rtrim = _.rtrim = (function ()
|
||||
|
||||
Reference in New Issue
Block a user