mirror of
https://github.com/liriliri/eruda.git
synced 2026-04-01 10:18:35 +08:00
Dev: Replace formatTime with ms
This commit is contained in:
@@ -2,7 +2,7 @@ import Tool from '../DevTools/Tool';
|
||||
import XhrRequest from './XhrRequest';
|
||||
import FetchRequest from './FetchRequest';
|
||||
import Settings from '../Settings/Settings';
|
||||
import {evalCss, isNative, defaults, now, extend, isEmpty, $} from '../lib/util';
|
||||
import {evalCss, isNative, defaults, now, extend, isEmpty, $, ms} from '../lib/util';
|
||||
|
||||
export default class Network extends Tool
|
||||
{
|
||||
@@ -140,7 +140,7 @@ export default class Network extends Tool
|
||||
extend(target, data);
|
||||
|
||||
target.time = target.time - target.startTime;
|
||||
target.displayTime = formatTime(target.time);
|
||||
target.displayTime = ms(target.time);
|
||||
|
||||
if (target.done && (target.status < 200 || target >= 300)) target.hasErr = true;
|
||||
|
||||
@@ -226,12 +226,3 @@ export default class Network extends Tool
|
||||
this._$el.html(html);
|
||||
}
|
||||
}
|
||||
|
||||
function formatTime(time)
|
||||
{
|
||||
time = Math.round(time);
|
||||
|
||||
if (time < 1000) return time + 'ms';
|
||||
|
||||
return (time / 1000).toFixed(1) + 's';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user