From 975032a6a045baa55714cc5a5d58e1e5f8ac09fb Mon Sep 17 00:00:00 2001 From: Anatoli Papirovski Date: Wed, 31 Jan 2018 10:36:32 -0500 Subject: [PATCH] timers: use const as appropriate PR-URL: https://github.com/nodejs/node/pull/18486 Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater Reviewed-By: Jeremiah Senkpiel --- lib/timers.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/timers.js b/lib/timers.js index 83affee7d83e69..734c58712d6f6c 100644 --- a/lib/timers.js +++ b/lib/timers.js @@ -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; }