mirror of https://github.com/nodejs/node.git
timers: use const as appropriate
PR-URL: https://github.com/nodejs/node/pull/18486 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
This commit is contained in:
parent
a986158cbf
commit
71c0d0370a
|
@ -224,8 +224,8 @@ function TimersList(msecs, unrefed) {
|
|||
// adds listOnTimeout to the C++ object prototype, as
|
||||
// V8 would not inline it otherwise.
|
||||
TimerWrap.prototype[kOnTimeout] = function listOnTimeout(now) {
|
||||
var list = this._list;
|
||||
var msecs = list.msecs;
|
||||
const list = this._list;
|
||||
const msecs = list.msecs;
|
||||
|
||||
debug('timeout callback %d', msecs);
|
||||
debug('now: %d', now);
|
||||
|
@ -322,7 +322,7 @@ function tryOnTimeout(timer, list) {
|
|||
function reuse(item) {
|
||||
L.remove(item);
|
||||
|
||||
var list = refedLists[item._idleTimeout];
|
||||
const list = refedLists[item._idleTimeout];
|
||||
// if empty - reuse the watcher
|
||||
if (list !== undefined && L.isEmpty(list)) {
|
||||
debug('reuse hit');
|
||||
|
@ -346,7 +346,7 @@ function unenroll(item) {
|
|||
item._destroyed = true;
|
||||
}
|
||||
|
||||
var handle = reuse(item);
|
||||
const handle = reuse(item);
|
||||
if (handle !== null) {
|
||||
debug('unenroll: list empty');
|
||||
handle.close();
|
||||
|
@ -429,7 +429,7 @@ exports.setTimeout = setTimeout;
|
|||
|
||||
|
||||
function ontimeout(timer, start) {
|
||||
var args = timer._timerArgs;
|
||||
const args = timer._timerArgs;
|
||||
if (typeof timer._onTimeout !== 'function')
|
||||
return promiseResolve(timer._onTimeout, args[0]);
|
||||
if (start === undefined && timer._repeat)
|
||||
|
@ -540,7 +540,7 @@ Timeout.prototype.unref = function() {
|
|||
if (this._handle) {
|
||||
this._handle.unref();
|
||||
} else if (typeof this._onTimeout === 'function') {
|
||||
var now = TimerWrap.now();
|
||||
const now = TimerWrap.now();
|
||||
if (!this._idleStart) this._idleStart = now;
|
||||
var delay = this._idleStart + this._idleTimeout - now;
|
||||
if (delay < 0) delay = 0;
|
||||
|
@ -551,7 +551,7 @@ Timeout.prototype.unref = function() {
|
|||
return;
|
||||
}
|
||||
|
||||
var handle = reuse(this);
|
||||
const handle = reuse(this);
|
||||
if (handle !== null) {
|
||||
handle._list = undefined;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue