UNPKG

2.94 kBTypeScriptView Raw
1import { Subscriber } from '../Subscriber';
2/**
3 * Creates an instance of an `OperatorSubscriber`.
4 * @param destination The downstream subscriber.
5 * @param onNext Handles next values, only called if this subscriber is not stopped or closed. Any
6 * error that occurs in this function is caught and sent to the `error` method of this subscriber.
7 * @param onError Handles errors from the subscription, any errors that occur in this handler are caught
8 * and send to the `destination` error handler.
9 * @param onComplete Handles completion notification from the subscription. Any errors that occur in
10 * this handler are sent to the `destination` error handler.
11 * @param onFinalize Additional teardown logic here. This will only be called on teardown if the
12 * subscriber itself is not already closed. This is called after all other teardown logic is executed.
13 */
14export declare function createOperatorSubscriber<T>(destination: Subscriber<any>, onNext?: (value: T) => void, onComplete?: () => void, onError?: (err: any) => void, onFinalize?: () => void): Subscriber<T>;
15/**
16 * A generic helper for allowing operators to be created with a Subscriber and
17 * use closures to capture necessary state from the operator function itself.
18 */
19export declare class OperatorSubscriber<T> extends Subscriber<T> {
20 private onFinalize?;
21 private shouldUnsubscribe?;
22 /**
23 * Creates an instance of an `OperatorSubscriber`.
24 * @param destination The downstream subscriber.
25 * @param onNext Handles next values, only called if this subscriber is not stopped or closed. Any
26 * error that occurs in this function is caught and sent to the `error` method of this subscriber.
27 * @param onError Handles errors from the subscription, any errors that occur in this handler are caught
28 * and send to the `destination` error handler.
29 * @param onComplete Handles completion notification from the subscription. Any errors that occur in
30 * this handler are sent to the `destination` error handler.
31 * @param onFinalize Additional finalization logic here. This will only be called on finalization if the
32 * subscriber itself is not already closed. This is called after all other finalization logic is executed.
33 * @param shouldUnsubscribe An optional check to see if an unsubscribe call should truly unsubscribe.
34 * NOTE: This currently **ONLY** exists to support the strange behavior of {@link groupBy}, where unsubscription
35 * to the resulting observable does not actually disconnect from the source if there are active subscriptions
36 * to any grouped observable. (DO NOT EXPOSE OR USE EXTERNALLY!!!)
37 */
38 constructor(destination: Subscriber<any>, onNext?: (value: T) => void, onComplete?: () => void, onError?: (err: any) => void, onFinalize?: (() => void) | undefined, shouldUnsubscribe?: (() => boolean) | undefined);
39 unsubscribe(): void;
40}
41//# sourceMappingURL=OperatorSubscriber.d.ts.map
\No newline at end of file