Skip to content

Type Alias: Subscription

Subscription = object

Defined in: abstractions/subscription.ts:10

Represents a subscription to a stream-like source.

A subscription is an object returned from a stream's subscribe method. It is the primary means for a consumer to manage their connection to the stream, allowing them to listen for values and unsubscribe when they are no longer needed.

Properties

unsubscribed

readonly unsubscribed: boolean

Defined in: abstractions/subscription.ts:16

A boolean flag indicating whether the subscription has been terminated. A value of true means the subscription is no longer active and cannot receive new values.

Methods

unsubscribe()

unsubscribe(): any

Defined in: abstractions/subscription.ts:26

Terminates the subscription and any associated listening process.

Calling this method triggers any cleanup logic defined for the subscription. It is idempotent, meaning calling it multiple times will not cause errors.

Returns

any

A CallbackReturnType which can be a Promise<void> if the cleanup is asynchronous.

Released under the MIT License.