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

Method evaluate

packages/effect/src/Micro.ts:514–539  ·  view source on GitHub ↗
(effect: Primitive)

Source from the content-addressed store, hash-verified

512 }
513
514 evaluate(effect: Primitive): void {
515 if (this._exit) {
516 return
517 } else if (this._yielded !== undefined) {
518 const yielded = this._yielded as () => void
519 this._yielded = undefined
520 yielded()
521 }
522 const exit = this.runLoop(effect)
523 if (exit === Yield) {
524 return
525 }
526
527 // the interruptChildren middlware is added in Micro.fork, so it can be
528 // tree-shaken if not used
529 const interruptChildren = fiberMiddleware.interruptChildren && fiberMiddleware.interruptChildren(this)
530 if (interruptChildren !== undefined) {
531 return this.evaluate(flatMap(interruptChildren, () => exit) as any)
532 }
533
534 this._exit = exit
535 for (let i = 0; i < this._observers.length; i++) {
536 this._observers[i](exit)
537 }
538 this._observers.length = 0
539 }
540
541 runLoop(effect: Primitive): MicroExit<A, E> | Yield {
542 let yielding = false

Callers 3

unsafeInterruptMethod · 0.95
unsafeForkFunction · 0.95
runForkFunction · 0.95

Calls 1

runLoopMethod · 0.95

Tested by

no test coverage detected