我使用下面的代码来获取chrome webRequest中的计算。以下是我想要计算的值,如this
request.addEventListener("readystatechange", function () {
var time = Date.now();
// this.startedDateTime refers when send is called.
switch (this.readyState) {
case 1:
this.startedDateTime = (new Date()).toISOString();
break;
case 2:
this._$connect = time;
this._send = (time - (new Date(this.startedDateTime)).getTime());
this._connect = (time - (new Date(this.startedDateTime)).getTime());
break;
case 3:
this._wait = time - this._$connect;
this._$wait = time;
break;
case 4:
this._receive = (time - this._$wait) || 0;
this._time = (time - (new Date(this.startedDateTime).getTime()));
break;
}
});
但是当我调试它时似乎不正确。如何才能正常工作。