Dev: Replace formatTime with ms

This commit is contained in:
redhoodsu
2018-04-18 11:21:40 +08:00
parent a15360838b
commit 00c0c84347
2 changed files with 261 additions and 186 deletions

View File

@@ -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';
}