Function: trackable()
trackable<
S
,T
>(stream
,tracker
):S
Defined in: trackable.ts:35
Wraps a particular stream so that its subscription lifecycle is automatically tracked by the provided Tracker.
When the decorated stream is subscribed to:
- It is registered with the tracker (via Tracker.track).
When the returned subscription is unsubscribed or the stream completes:
- The underlying stream subscription is unsubscribed.
- Tracker.complete is called, removing it from the tracker and completing its status observable.
This prevents the need for manual tracker management in consumer code.
Type Parameters
S
S
extends Stream
<T
>
T
T
= any
The type of values emitted by the stream.
Parameters
stream
S
The Streamix Stream instance to decorate.
tracker
The Tracker instance used to monitor this stream's lifecycle.
Returns
S
The same stream instance, but with its .subscribe()
method overridden to include tracker lifecycle handling. The subscription returned by .subscribe()
will also handle cleanup automatically.