Skip to content

Commit

Permalink
Merge pull request #385 from chrisnicola/patch-1
Browse files Browse the repository at this point in the history
Use local reference for clearTimeout global
  • Loading branch information
ljharb committed Sep 1, 2017
2 parents fde8216 + 5565ef5 commit de7f4fa
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ var nextTick = typeof setImmediate !== 'undefined'
: process.nextTick
;
var safeSetTimeout = setTimeout;
var safeClearTimeout = clearTimeout;

inherits(Test, EventEmitter);

Expand Down Expand Up @@ -127,7 +128,7 @@ Test.prototype.timeoutAfter = function(ms) {
self.end();
}, ms);
this.once('end', function() {
clearTimeout(timeout);
safeClearTimeout(timeout);
});
}

Expand Down

0 comments on commit de7f4fa

Please sign in to comment.