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) {
|
const clearTimeout = exports.clearTimeout = function(timer) {
|
||||||
if (timer && (timer[kOnTimeout] || timer._onTimeout)) {
|
if (timer && timer._onTimeout) {
|
||||||
timer[kOnTimeout] = timer._onTimeout = null;
|
timer._onTimeout = null;
|
||||||
if (timer instanceof Timeout) {
|
if (timer instanceof Timeout) {
|
||||||
timer.close(); // for after === 0
|
timer.close(); // for after === 0
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user