MCPcopy Index your code
hub / github.com/nodejs/node / timeoutPromise

Function timeoutPromise

test/common/inspector-helper.js:520–534  ·  view source on GitHub ↗
(error, timeoutMs)

Source from the content-addressed store, hash-verified

518}
519
520function timeoutPromise(error, timeoutMs) {
521 let clearCallback = null;
522 let done = false;
523 const promise = onResolvedOrRejected(new Promise((resolve, reject) => {
524 const timeout = setTimeout(() => reject(error), timeoutMs);
525 clearCallback = () => {
526 if (done)
527 return;
528 clearTimeout(timeout);
529 resolve();
530 };
531 }), () => done = true);
532 promise.clear = clearCallback;
533 return promise;
534}
535
536// Returns a new promise that will propagate `promise` resolution or rejection
537// if that happens within the `timeoutMs` timespan, or rejects with `error` as

Callers 2

firesFunction · 0.70
EventWatcherFunction · 0.50

Calls 5

onResolvedOrRejectedFunction · 0.85
resolveFunction · 0.70
setTimeoutFunction · 0.50
rejectFunction · 0.50
clearTimeoutFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…