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

Function setWeakAbortSignalTimeout

lib/internal/abort_controller.js:202–217  ·  view source on GitHub ↗
(weakRef, delay)

Source from the content-addressed store, hash-verified

200// the created timer object. Separately, we add the signal to a
201// FinalizerRegistry that will clear the timeout when the signal is gc'd.
202function setWeakAbortSignalTimeout(weakRef, delay) {
203 const timeout = setTimeout(() => {
204 const signal = weakRef.deref();
205 if (signal !== undefined) {
206 clearTimeoutRegistry.unregister(signal);
207 gcPersistentSignals.delete(signal);
208 abortSignal(
209 signal,
210 new DOMException(
211 'The operation was aborted due to timeout',
212 'TimeoutError'));
213 }
214 }, delay);
215 timeout.unref();
216 return timeout;
217}
218
219class AbortSignal extends EventTarget {
220

Callers 1

timeoutMethod · 0.85

Calls 4

abortSignalFunction · 0.85
deleteMethod · 0.65
setTimeoutFunction · 0.50
unrefMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…