mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
timers: simplify clearTimeout & clearInterval
Remove unnecessary condition from timeout & interval clearing. PR-URL: https://github.com/nodejs/node/pull/18579 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
parent
c11cb038a1
commit
8204b0f9c6
@ -465,8 +465,8 @@ function rearm(timer, start = TimerWrap.now()) {
|
||||
|
||||
|
||||
const clearTimeout = exports.clearTimeout = function(timer) {
|
||||
if (timer && (timer[kOnTimeout] || timer._onTimeout)) {
|
||||
timer[kOnTimeout] = timer._onTimeout = null;
|
||||
if (timer && timer._onTimeout) {
|
||||
timer._onTimeout = null;
|
||||
if (timer instanceof Timeout) {
|
||||
timer.close(); // for after === 0
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user