Skip to content

Commit

Permalink
fix clearTimeout issue
Browse files Browse the repository at this point in the history
  • Loading branch information
connorjclark committed Jul 1, 2024
1 parent 9141bdb commit 3af986d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions cli/sentry-prompt.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function prompt() {
return Promise.resolve(false);
}

/** @type {NodeJS.Timer|undefined} */
/** @type {NodeJS.Timeout|undefined} */
let timeout;

const prompt = new Confirm.Confirm({
Expand All @@ -47,7 +47,7 @@ function prompt() {

return Promise.race([
prompt.run().then(result => {
clearTimeout(/** @type {NodeJS.Timer} */ (timeout));
clearTimeout(/** @type {NodeJS.Timeout} */ (timeout));
return result;
}),
timeoutPromise,
Expand Down
8 changes: 4 additions & 4 deletions core/gather/driver/wait-for-condition.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ function waitForFcp(session, pauseAfterFcpMs, maxWaitForFcpMs) {
*/
function waitForNetworkIdle(session, networkMonitor, networkQuietOptions) {
let hasDCLFired = false;
/** @type {NodeJS.Timer|undefined} */
/** @type {NodeJS.Timeout|undefined} */
let idleTimeout;
/** @type {(() => void)} */
let cancel = () => {
Expand Down Expand Up @@ -225,7 +225,7 @@ function waitForCPUIdle(session, waitForCPUQuiet) {
};
}

/** @type {NodeJS.Timer|undefined} */
/** @type {NodeJS.Timeout|undefined} */
let lastTimeout;
let canceled = false;

Expand Down Expand Up @@ -355,7 +355,7 @@ function waitForLoadEvent(session, pauseAfterLoadMs) {
};

const promise = new Promise((resolve, reject) => {
/** @type {NodeJS.Timer|undefined} */
/** @type {NodeJS.Timeout|undefined} */
let loadTimeout;
const loadListener = function() {
loadTimeout = setTimeout(resolve, pauseAfterLoadMs);
Expand Down Expand Up @@ -420,7 +420,7 @@ async function waitForFullyLoaded(session, networkMonitor, options) {
cpuQuietThresholdMs, maxWaitForLoadedMs, maxWaitForFcpMs} = options;
const {waitForFcp, waitForLoadEvent, waitForNetworkIdle, waitForCPUIdle} =
options._waitForTestOverrides || DEFAULT_WAIT_FUNCTIONS;
/** @type {NodeJS.Timer|undefined} */
/** @type {NodeJS.Timeout|undefined} */
let maxTimeoutHandle;

// Listener for FCP. Resolves pauseAfterFcpMs ms after first FCP event.
Expand Down
2 changes: 1 addition & 1 deletion core/gather/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class ProtocolSession extends CrdpEventEmitter {
const timeoutMs = this.getNextProtocolTimeout();
this._nextProtocolTimeout = undefined;

/** @type {NodeJS.Timer|undefined} */
/** @type {NodeJS.Timeout|undefined} */
let timeout;
const timeoutPromise = new Promise((resolve, reject) => {
// Unexpected setTimeout invocation to preserve the error stack. https://github.com/GoogleChrome/lighthouse/issues/13332
Expand Down

0 comments on commit 3af986d

Please sign in to comment.