Optional
destination: Subscriber<any> | Observer<any>Internal implementation detail, do not use directly. Will be made internal in v8. There is no reason to directly create an instance of Subscriber. This type is exported for typings reasons.
A flag to indicate whether this Subscription has already been unsubscribed.
Protected
destinationInternal implementation detail, do not use directly. Will be made internal in v8.
Protected
isInternal implementation detail, do not use directly. Will be made internal in v8.
Static
EMPTYProtected
_completeProtected
_errorProtected
_nextAdds a finalizer to this subscription, so that finalization will be unsubscribed/called when this subscription is unsubscribed. If this subscription is already #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 #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.
Optional
err: anyThe error
exception.
Removes a finalizer from this subscription that was previously added with the #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
Static
createA static factory for a Subscriber, given a (potentially partial) definition of an Observer.
Optional
next: ((x?) => void)The next
callback of an Observer.
Optional
x: TOptional
error: ((e?) => void)The error
callback of an
Observer.
Optional
e: anyOptional
complete: (() => void)The complete
callback of an
Observer.
A Subscriber wrapping the (partially defined) Observer represented by the given arguments.
Do not use. Will be removed in v8. There is no replacement for this
method, and there is no reason to be creating instances of Subscriber
directly.
If you have a specific use case, please file an issue.
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.Subscriber