Skip to content

Commit

Permalink
timers: use const as appropriate
Browse files Browse the repository at this point in the history
PR-URL: nodejs#18486
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Jeremiah Senkpiel <[email protected]>
  • Loading branch information
apapirovski authored and MayaLekova committed May 8, 2018
1 parent b531515 commit 975032a
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/timers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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');
Expand All @@ -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();
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand All @@ -551,7 +551,7 @@ Timeout.prototype.unref = function() {
return;
}

var handle = reuse(this);
const handle = reuse(this);
if (handle !== null) {
handle._list = undefined;
}
Expand Down

0 comments on commit 975032a

Please sign in to comment.