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

Method addObserver

packages/effect/src/internal/effect.ts:598–605  ·  view source on GitHub ↗
(cb: (exit: Exit.Exit<A, E>) => void)

Source from the content-addressed store, hash-verified

596 return Context.getReferenceUnsafe(this.context, ref)
597 }
598 addObserver(cb: (exit: Exit.Exit<A, E>) => void): () => void {
599 if (this._exit) {
600 cb(this._exit)
601 return constVoid
602 }
603 ;(this._observers ??= []).push(cb)
604 return () => this.removeObserver(cb)
605 }
606 removeObserver(cb: (exit: Exit.Exit<A, E>) => void): void {
607 if (this._exit || this._observers === undefined) return
608 const index = this._observers.indexOf(cb)

Callers 15

raceAllFunction · 0.95
raceAllFirstFunction · 0.95
onMessageFunction · 0.80
BrowserRuntime.tsFile · 0.80
layerFunction · 0.80
NodeRuntime.tsFile · 0.80
constructorMethod · 0.80
_destroyMethod · 0.80
DenoRuntime.tsFile · 0.80
onMessageFunction · 0.80
onMessageFunction · 0.80
restoreFunction · 0.80

Calls 2

removeObserverMethod · 0.95
pushMethod · 0.65

Tested by

no test coverage detected