Subscriber
Extends:
Direct Subclass:
Indirect Subclass:
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.
Test:
Static Method Summary
Static Public Methods | ||
public static |
create(next: function(x: ?T): void, error: function(e: ?any): void, complete: function(): void): Subscriber<T> A static factory for a Subscriber, given a (potentially partial) definition of an Observer. |
Constructor Summary
Public Constructor | ||
public |
constructor(destinationOrNext: Observer | function(value: T): void, error: function(e: ?any): void, complete: function(): void) |
Method Summary
Public Methods | ||
public |
complete(): void The Observer callback to receive a valueless notification of type
|
|
public |
error(err: any): void |
|
public |
next(value: T): void The Observer callback to receive notifications of type |
Inherited Summary
From class Subscription | ||
public |
A flag to indicate whether this Subscription has already been unsubscribed. |
|
public |
add(teardown: TeardownLogic): Subscription Adds a tear down to be called during the unsubscribe() of this Subscription. |
|
public |
remove(subscription: Subscription): void Removes a Subscription from the internal list of subscriptions that will unsubscribe during the unsubscribe process of this Subscription. |
|
public |
unsubscribe(): void Disposes the resources held by the subscription. |
Static Public Methods
public static create(next: function(x: ?T): void, error: function(e: ?any): void, complete: function(): void): Subscriber<T> source
A static factory for a Subscriber, given a (potentially partial) definition of an Observer.
Return:
Subscriber<T> | A Subscriber wrapping the (partially defined) Observer represented by the given arguments. |
Public Constructors
public constructor(destinationOrNext: Observer | function(value: T): void, error: function(e: ?any): void, complete: function(): void) source
Override:
Subscription#constructorParams:
Name | Type | Attribute | Description |
destinationOrNext | Observer | function(value: T): void |
|
A partially
defined Observer or a |
error | function(e: ?any): void |
|
The |
complete | function(): void |
|
The |
Public Methods
public complete(): void source
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.
Return:
void |
public error(err: any): void source
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.
Params:
Name | Type | Attribute | Description |
err | any |
|
The |
Return:
void |