Subscriber
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.
class Subscriber<T> extends Subscription implements Observer {
static create<T>(next?: (x?: T) => void, error?: (e?: any) => void, complete?: () => void): Subscriber<T>
constructor(destinationOrNext?: PartialObserver<any> | ((value: T) => void), error?: (e?: any) => void, complete?: () => void)
protected isStopped: boolean
protected destination: PartialObserver<any> | Subscriber<any>
next(value?: T): void
error(err?: any): void
complete(): void
unsubscribe(): void
protected _next(value: T): void
protected _error(err: any): void
protected _complete(): void
_unsubscribeAndRecycle(): Subscriber<T>
// inherited from index/Subscription
static EMPTY: Subscription
constructor(unsubscribe?: () => void)
closed: [object Object]
unsubscribe(): void
add(teardown: TeardownLogic): Subscription
remove(subscription: Subscription): void
}
Static Methods
Constructor
Parameters
|
Properties
Property | Type | Description |
---|---|---|
isStopped | ||
destination |
Methods
next() | ||
---|---|---|
The |
||
Parameters
Returns
|
error() | ||
---|---|---|
The |
||
Parameters
Returns
|
complete() |
---|
The |
ParametersThere are no parameters. Returns
|
unsubscribe() |
---|
ParametersThere are no parameters. Returns
|
_next() | ||
---|---|---|
Parameters
Returns
|
_error() | ||
---|---|---|
Parameters
Returns
|
_complete() |
---|
ParametersThere are no parameters. Returns
|
_unsubscribeAndRecycle() |
---|
ParametersThere are no parameters. Returns
|