diff options
Diffstat (limited to 'lib/timers.js')
-rw-r--r-- | lib/timers.js | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/timers.js b/lib/timers.js index 88fd31ad4c..ad00ede974 100644 --- a/lib/timers.js +++ b/lib/timers.js @@ -496,14 +496,13 @@ exports.setInterval = function(callback, repeat, arg1, arg2, arg3) { return timeout; }; -exports.clearInterval = function(timer) { - if (timer && timer._repeat) { - timer._repeat = null; - clearTimeout(timer); - } +exports.clearInterval = function clearInterval(timer) { + // clearTimeout and clearInterval can be used to clear timers created from + // both setTimeout and setInterval, as specified by HTML Living Standard: + // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-setinterval + clearTimeout(timer); }; - function unrefdHandle(timer, now) { try { // Don't attempt to call the callback if it is not a function. |