mirror of
https://github.com/liriliri/eruda.git
synced 2026-04-01 10:18:35 +08:00
Fix: Prevent negative timing data
This commit is contained in:
@@ -336,7 +336,7 @@ export default class Network extends Tool
|
||||
|
||||
if (!cfg.get('disablePerformance'))
|
||||
{
|
||||
this._getPerformanceTimingData();
|
||||
util.ready(() => this._getPerformanceTimingData());
|
||||
renderData.data = this._performanceTimingData;
|
||||
renderData.timing = this._performanceTiming;
|
||||
}
|
||||
|
||||
@@ -5401,6 +5401,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