diff options
author | RĂ©mi Berson <remi@cliqz.com> | 2018-04-11 18:49:07 +0300 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2018-04-16 05:42:30 +0300 |
commit | 978e1524bba34fb92e6710f589329cd03cbec87b (patch) | |
tree | fa769e8478b6dc1804c104817ffa61f962390356 /doc/api/timers.md | |
parent | 2b6bb9f588aa791a385c8a5075ab5e207f9a739d (diff) |
timers: fix clearInterval to work with timers from setTimeout
According to HTML Living Standard, "either method [clearInterval or
clearTimeout] can be used to clear timers created by setTimeout() or
setInterval().".
The current implementation of clearTimeout is already able to destroy a
timer created by setInterval, but not the other way around.
PR-URL: https://github.com/nodejs/node/pull/19952
Refs: https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-setinterval
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Diffstat (limited to 'doc/api/timers.md')
-rw-r--r-- | doc/api/timers.md | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/doc/api/timers.md b/doc/api/timers.md index 9c455552b14..0cc535352a0 100644 --- a/doc/api/timers.md +++ b/doc/api/timers.md @@ -56,8 +56,8 @@ Returns a reference to the `Immediate`. ## Class: Timeout This object is created internally and is returned from [`setTimeout()`][] and -[`setInterval()`][]. It can be passed to [`clearTimeout()`][] or -[`clearInterval()`][] (respectively) in order to cancel the scheduled actions. +[`setInterval()`][]. It can be passed to either [`clearTimeout()`][] or +[`clearInterval()`][] in order to cancel the scheduled actions. By default, when a timer is scheduled using either [`setTimeout()`][] or [`setInterval()`][], the Node.js event loop will continue running as long as the |