mirror of https://github.com/nodejs/node.git
Revert "timers: refactor to use optional chaining"
This reverts commit d8f535b025
.
PR-URL: https://github.com/nodejs/node/pull/38245
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
Reviewed-By: Beth Griggs <bgriggs@redhat.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
pull/37678/head
parent
4afcd55274
commit
a0261d231c
|
@ -171,7 +171,7 @@ ObjectDefineProperty(setTimeout, customPromisify, {
|
|||
});
|
||||
|
||||
function clearTimeout(timer) {
|
||||
if (timer?._onTimeout) {
|
||||
if (timer && timer._onTimeout) {
|
||||
timer._onTimeout = null;
|
||||
unenroll(timer);
|
||||
return;
|
||||
|
|
|
@ -53,7 +53,10 @@ function setTimeout(after, value, options = {}) {
|
|||
'boolean',
|
||||
ref));
|
||||
}
|
||||
if (signal?.aborted) {
|
||||
// TODO(@jasnell): If a decision is made that this cannot be backported
|
||||
// to 12.x, then this can be converted to use optional chaining to
|
||||
// simplify the check.
|
||||
if (signal && signal.aborted) {
|
||||
return PromiseReject(new AbortError());
|
||||
}
|
||||
let oncancel;
|
||||
|
@ -95,7 +98,10 @@ function setImmediate(value, options = {}) {
|
|||
'boolean',
|
||||
ref));
|
||||
}
|
||||
if (signal?.aborted) {
|
||||
// TODO(@jasnell): If a decision is made that this cannot be backported
|
||||
// to 12.x, then this can be converted to use optional chaining to
|
||||
// simplify the check.
|
||||
if (signal && signal.aborted) {
|
||||
return PromiseReject(new AbortError());
|
||||
}
|
||||
let oncancel;
|
||||
|
|
Loading…
Reference in New Issue