Emitter overview
Emitter is a helper for creating Fx from external libraries which are not Effect-native.
Added in v1.20.0
Table of contents
utils
Emitter (interface)
Signature
export interface Emitter<in A, in E> {
readonly succeed: (value: A) => Promise<Exit.Exit<unknown>>
readonly failCause: (cause: Cause.Cause<E>) => Promise<Exit.Exit<unknown>>
readonly fail: (error: E) => Promise<Exit.Exit<unknown>>
readonly die: (error: unknown) => Promise<Exit.Exit<unknown>>
readonly end: () => Promise<Exit.Exit<unknown>>
}
Added in v1.20.0
withEmitter
Signature
export declare function withEmitter<A, E, R, R2, B>(
sink: Sink.Sink<A, E, R>,
f: (emitter: Emitter<A, E>) => Effect.Effect<B, E, R2>
): Effect.Effect<void, never, R | R2 | Scope.Scope>
Added in v1.20.0