MCPcopy Create free account
hub / github.com/freecodexyz/free-code / removeAbortHandler

Function removeAbortHandler

src/utils/abortController.ts:44–53  ·  view source on GitHub ↗

* Removes an abort handler from a weakly-referenced parent signal. * Both parent and handler are weakly held — if either has been GC'd * or the parent already aborted ({once: true}), this is a no-op. * Module-scope function avoids per-call closure allocation.

(
  this: WeakRef<AbortController>,
  weakHandler: WeakRef<(...args: unknown[]) => void>,
)

Source from the content-addressed store, hash-verified

42 * Module-scope function avoids per-call closure allocation.
43 */
44function removeAbortHandler(
45 this: WeakRef<AbortController>,
46 weakHandler: WeakRef<(...args: unknown[]) => void>,
47): void {
48 const parent = this.deref()
49 const handler = weakHandler.deref()
50 if (parent && handler) {
51 parent.signal.removeEventListener('abort', handler)
52 }
53}
54
55/**
56 * Creates a child AbortController that aborts when its parent aborts.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected