MCPcopy Create free account
hub / github.com/effect-app/libs / addObserver

Method addObserver

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

Source from the content-addressed store, hash-verified

550 currentPreventYield!: boolean
551
552 _dispatcher: Scheduler.SchedulerDispatcher | undefined = undefined
553 get currentDispatcher(): Scheduler.SchedulerDispatcher {
554 return this._dispatcher ??= this.currentScheduler.makeDispatcher()
555 }
556
557 getRef<X>(ref: Context.Reference<X>): X {
558 return Context.get(this.context, ref)
559 }
560 addObserver(cb: (exit: Exit.Exit<A, E>) => void): () => void {
561 if (this._exit) {
562 cb(this._exit)
563 return constVoid
564 }
565 this._observers.push(cb)
566 return () => {
567 const index = this._observers.indexOf(cb)

Callers 15

utils.tsFile · 0.80
onMessageFunction · 0.80
NodeRuntime.tsFile · 0.80
constructorMethod · 0.80
_destroyMethod · 0.80
runFunction · 0.80
onMessageFunction · 0.80
makeRunMainFunction · 0.80
FiberSet.tsFile · 0.80
runtimePromiseFunction · 0.80
FiberHandle.tsFile · 0.80

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected