Skip to content

Type Alias: Receiver<T>

Receiver<T> = object

Defined in: abstractions/receiver.ts:24

Defines a receiver interface for handling a stream's lifecycle events.

A receiver is an object that can be passed to a stream's subscribe method to handle the three primary events in a stream's lifecycle: next for new values, error for stream errors, and complete when the stream has finished.

All properties are optional, allowing you to subscribe only to the events you care about.

Type Parameters

T

T = any

The type of the value handled by the receiver's next method.

Properties

next()?

optional next: (value) => CallbackReturnType

Defined in: abstractions/receiver.ts:29

A function called for each new value emitted by the stream.

Parameters

value

T

The value emitted by the stream.

Returns

CallbackReturnType


error()?

optional error: (err) => CallbackReturnType

Defined in: abstractions/receiver.ts:34

A function called if the stream encounters an error.

Parameters

err

Error

The error that occurred.

Returns

CallbackReturnType


complete()?

optional complete: () => CallbackReturnType

Defined in: abstractions/receiver.ts:38

A function called when the stream has completed successfully and will emit no more values.

Returns

CallbackReturnType

Released under the MIT License.