@epikodelabs/streamix / src/public-api / Subscription
Type Alias: Subscription
Subscription = () =>
MaybePromise&object
Defined in: projects/libraries/streamix/src/lib/atoms/subscription.ts:19
Represents a subscription to a stream-like source.
A Subscription is returned from a stream's subscribe() method and represents an active connection between a producer and a consumer.
The subscription itself is callable: calling it is shorthand for unsubscription. This supports the idiomatic pattern:
ts
const unsubscribe = count.subscribe((current, previous) => { ... });
unsubscribe();
// or, if teardown is async:
await unsubscribe();Type Declaration
unsubscribed
readonlyunsubscribed:boolean
Indicates whether the subscription has been terminated.
false- subscription is activetrue- subscription has been unsubscribed and is inactive
This flag becomes true immediately when the subscription is invoked for the first time.