mirror of https://github.com/nodejs/node.git
timers: refactor to use optional chaining
PR-URL: https://github.com/nodejs/node/pull/36767 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>pull/34284/head
parent
9574e5b632
commit
d8f535b025
|
@ -171,7 +171,7 @@ ObjectDefineProperty(setTimeout, customPromisify, {
|
|||
});
|
||||
|
||||
function clearTimeout(timer) {
|
||||
if (timer && timer._onTimeout) {
|
||||
if (timer?._onTimeout) {
|
||||
timer._onTimeout = null;
|
||||
unenroll(timer);
|
||||
return;
|
||||
|
|
|
@ -49,10 +49,7 @@ function setTimeout(after, value, options = {}) {
|
|||
'boolean',
|
||||
ref));
|
||||
}
|
||||
// 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) {
|
||||
if (signal?.aborted) {
|
||||
return PromiseReject(new AbortError());
|
||||
}
|
||||
let oncancel;
|
||||
|
@ -94,10 +91,7 @@ function setImmediate(value, options = {}) {
|
|||
'boolean',
|
||||
ref));
|
||||
}
|
||||
// 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) {
|
||||
if (signal?.aborted) {
|
||||
return PromiseReject(new AbortError());
|
||||
}
|
||||
let oncancel;
|
||||
|
|
Loading…
Reference in New Issue