Skip to content

Commit 71c0d03

Browse files
committed
timers: use const as appropriate
PR-URL: #18486 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]>
1 parent a986158 commit 71c0d03

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

lib/timers.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,8 @@ function TimersList(msecs, unrefed) {
224224
// adds listOnTimeout to the C++ object prototype, as
225225
// V8 would not inline it otherwise.
226226
TimerWrap.prototype[kOnTimeout] = function listOnTimeout(now) {
227-
var list = this._list;
228-
var msecs = list.msecs;
227+
const list = this._list;
228+
const msecs = list.msecs;
229229

230230
debug('timeout callback %d', msecs);
231231
debug('now: %d', now);
@@ -322,7 +322,7 @@ function tryOnTimeout(timer, list) {
322322
function reuse(item) {
323323
L.remove(item);
324324

325-
var list = refedLists[item._idleTimeout];
325+
const list = refedLists[item._idleTimeout];
326326
// if empty - reuse the watcher
327327
if (list !== undefined && L.isEmpty(list)) {
328328
debug('reuse hit');
@@ -346,7 +346,7 @@ function unenroll(item) {
346346
item._destroyed = true;
347347
}
348348

349-
var handle = reuse(item);
349+
const handle = reuse(item);
350350
if (handle !== null) {
351351
debug('unenroll: list empty');
352352
handle.close();
@@ -429,7 +429,7 @@ exports.setTimeout = setTimeout;
429429

430430

431431
function ontimeout(timer, start) {
432-
var args = timer._timerArgs;
432+
const args = timer._timerArgs;
433433
if (typeof timer._onTimeout !== 'function')
434434
return promiseResolve(timer._onTimeout, args[0]);
435435
if (start === undefined && timer._repeat)
@@ -540,7 +540,7 @@ Timeout.prototype.unref = function() {
540540
if (this._handle) {
541541
this._handle.unref();
542542
} else if (typeof this._onTimeout === 'function') {
543-
var now = TimerWrap.now();
543+
const now = TimerWrap.now();
544544
if (!this._idleStart) this._idleStart = now;
545545
var delay = this._idleStart + this._idleTimeout - now;
546546
if (delay < 0) delay = 0;
@@ -551,7 +551,7 @@ Timeout.prototype.unref = function() {
551551
return;
552552
}
553553

554-
var handle = reuse(this);
554+
const handle = reuse(this);
555555
if (handle !== null) {
556556
handle._list = undefined;
557557
}

0 commit comments

Comments
 (0)