A flag to indicate whether this Subscription has already been unsubscribed.
Adds a finalizer to this subscription, so that finalization will be unsubscribed/called when this subscription is unsubscribed. If this subscription is already {@link #closed}, because it has already been unsubscribed, then whatever finalizer is passed to it will automatically be executed (unless the finalizer itself is also a closed subscription).
Closed Subscriptions cannot be added as finalizers to any subscription. Adding a closed subscription to a any subscription will result in no operation. (A noop).
Adding a subscription to itself, or adding null
or undefined
will not perform any
operation at all. (A noop).
Subscription
instances that are added to this instance will automatically remove themselves
if they are unsubscribed. Functions and Unsubscribable objects that you wish to remove
will need to be removed manually with {@link #remove}
The finalization logic to add to this subscription.
The Observer callback to receive a valueless notification of type
complete
from the Observable. Notifies the Observer that the Observable
has finished sending push-based notifications.
The Observer callback to receive notifications of type error
from
the Observable, with an attached Error
. Notifies the Observer that
the Observable has experienced an error condition.
The Observer callback to receive notifications of type next
from
the Observable, with a value. The Observable may call this method 0 or more
times.
Removes a finalizer from this subscription that was previously added with the {@link #add} method.
Note that Subscription
instances, when unsubscribed, will automatically remove themselves
from every other Subscription
they have been added to. This means that using the remove
method
is not a common thing and should be used thoughtfully.
If you add the same finalizer instance of a function or an unsubscribable object to a Subscription
instance
more than once, you will need to call remove
the same number of times to remove all instances.
All finalizer instances are removed to free up memory upon unsubscription.
The finalizer to remove from this subscription
Disposes the resources held by the subscription. May, for instance, cancel an ongoing Observable execution or cancel any other type of work that started when the Subscription was created.
A static factory for a Subscriber, given a (potentially partial) definition of an Observer.
The next
callback of an Observer.
The error
callback of an
Observer.
The complete
callback of an
Observer.
A Subscriber wrapping the (partially defined) Observer represented by the given arguments.
Implements the Observer interface and extends the Subscription class. While the Observer is the public API for consuming the values of an Observable, all Observers get converted to a Subscriber, in order to provide Subscription-like capabilities such as
unsubscribe
. Subscriber is a common type in RxJS, and crucial for implementing operators, but it is rarely used as a public API.