Skip to main content

Type Alias: Subscription

Subscription = RxSub

Subscription represents a handle to an active subscription on an Observable.

Remarks

This type is simply an alias for RxJS’s Subscription and provides the unsubscribe method. Always call unsubscribe() when the observable is no longer needed to avoid memory leaks.

Example

const subscription: Subscription = someObservable.subscribe(data => {
console.log('Received data:', data);
});
// Later, cleanup the subscription:
subscription.unsubscribe();