MCPcopy Create free account
hub / github.com/Effect-TS/effect / Signal

Class Signal

packages/ui/native/src/NativeHttpClient.ts:491–506  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

489
490// Supply AbortController without bundling React Native's XHR stack.
491class Signal {
492 aborted = false
493 reason: unknown = undefined
494 onabort: ((event: object) => void) | null = null
495 listeners: Array<(event: object) => void> = []
496 addEventListener(type: string, listener: (event: object) => void) {
497 if (type === "abort") this.listeners.push(listener)
498 }
499 removeEventListener(type: string, listener: (event: object) => void) {
500 const index = this.listeners.indexOf(listener)
501 if (type === "abort" && index !== -1) this.listeners.splice(index, 1)
502 }
503 throwIfAborted() {
504 if (this.aborted) throw this.reason
505 }
506}
507
508class Controller {
509 readonly signal = new Signal()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected