X Tutup
The Wayback Machine - https://web.archive.org/web/20220419212620/https://github.com/nodejs/node/commit/a0261d231c
Skip to content
Permalink
Browse files
Revert "timers: refactor to use optional chaining"
This reverts commit d8f535b.

PR-URL: #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>
  • Loading branch information
mcollina authored and BethGriggs committed Apr 19, 2021
1 parent 4afcd55 commit a0261d231c4353cbea29d0c747c4e604d3dcb6aa
Showing with 9 additions and 3 deletions.
  1. +1 −1 lib/timers.js
  2. +8 −2 lib/timers/promises.js
@@ -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;

0 comments on commit a0261d2

Please sign in to comment.
X Tutup