Skip to content

Commit

Permalink
timers: use const as appropriate
Browse files Browse the repository at this point in the history
  • Loading branch information
apapirovski committed Feb 2, 2018
1 parent cdf6da5 commit 8c6953d
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 @@ -222,8 +222,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 @@ -320,7 +320,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 @@ -344,7 +344,7 @@ const unenroll = exports.unenroll = function(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 @@ -417,7 +417,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 @@ -528,7 +528,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 @@ -539,7 +539,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 8c6953d

Please sign in to comment.