Last active
September 3, 2018 00:05
-
-
Save Devcon4/91cd6a440e4c95de7c1492517d90b643 to your computer and use it in GitHub Desktop.
SubscriberSource
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Implements the {@link Observer} interface and extends the | |
| * {@link Subscription} class. While the {@link Observer} is the public API for | |
| * consuming the values of an {@link 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> | |
| */ | |
| export class Subscriber<T> extends Subscription implements Observer<T> { | |
| constructor(destinationOrNext?: PartialObserver<any> | ((value: T) => void), | |
| error?: (e?: any) => void, | |
| complete?: () => void) {} | |
| next(value?: T): void {} | |
| error(err?: any): void {} | |
| complete(): void {} | |
| unsubscribe(): void {} | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Represents a disposable resource, such as the execution of an Observable. A | |
| * Subscription has one important method, `unsubscribe`, that takes no argument | |
| * and just disposes the resource held by the subscription. | |
| * | |
| * Additionally, subscriptions may be grouped together through the `add()` | |
| * method, which will attach a child Subscription to the current Subscription. | |
| * When a Subscription is unsubscribed, all its children (and its grandchildren) | |
| * will be unsubscribed as well. | |
| * | |
| * @class Subscription | |
| */ | |
| export class Subscription implements SubscriptionLike { | |
| unsubscribe(): void {} | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment