Package: effect
Module: Latch
Waits on the latch, then runs the provided effect.
When to use
Use to gate another effect so it starts only after the latch is opened or the current waiters are released.
Details
If the latch is open, the effect runs immediately. If it is closed, the returned effect suspends until the latch is opened or the current waiters are released. The provided effect’s success, failure, and requirements are preserved.
See
await for waiting without running another effectopen for opening the latch for current and future waitersrelease for resuming current waiters without opening the latchSignature
declare const whenOpen: { (self: Latch): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>; <A, E, R>(self: Latch, effect: Effect.Effect<A, E, R>): Effect.Effect<A, E, R>; }
Since v4.0.0