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

Function doneUnsafe

packages/effect/src/Deferred.ts:881–895  ·  view source on GitHub ↗
(self: Deferred<A, E>, effect: Effect<A, E>)

Source from the content-addressed store, hash-verified

879 * @since 4.0.0
880 */
881export const doneUnsafe = <A, E>(self: Deferred<A, E>, effect: Effect<A, E>): boolean => {
882 if (self.effect) return false
883 self.effect = effect
884 if (self.resumes) {
885 // Clear `resumes` before resuming: a waiter resumed with an interrupt
886 // cause dies synchronously inside `resume`, and its await cleanup would
887 // otherwise splice this array mid-iteration and skip the next waiter.
888 const resumes = self.resumes
889 self.resumes = undefined
890 for (let i = 0; i < resumes.length; i++) {
891 resumes[i](effect)
892 }
893 }
894 return true
895}
896
897/**
898 * Runs an `Effect` and attempts to complete a `Deferred` with the effect's

Callers 1

Deferred.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected