Debian Codegraph @

node/rxjs/dist/types/internal/Subscriber.d.ts

raw
1 import { Observer } from './types';
2 import { Subscription } from './Subscription';
3 /**
4 * Implements the {@link Observer} interface and extends the
5 * {@link Subscription} class. While the {@link Observer} is the public API for
6 * consuming the values of an {@link Observable}, all Observers get converted to
7 * a Subscriber, in order to provide Subscription-like capabilities such as
8 * `unsubscribe`. Subscriber is a common type in RxJS, and crucial for
9 * implementing operators, but it is rarely used as a public API.
10 */
11 export declare class Subscriber<T> extends Subscription implements Observer<T> {
12 /**
13 * A static factory for a Subscriber, given a (potentially partial) definition
14 * of an Observer.
15 * @param next The `next` callback of an Observer.
16 * @param error The `error` callback of an
17 * Observer.
18 * @param complete The `complete` callback of an
19 * Observer.
20 * @return A Subscriber wrapping the (partially defined)
21 * Observer represented by the given arguments.
22 * @deprecated Do not use. Will be removed in v8. There is no replacement for this
23 * method, and there is no reason to be creating instances of `Subscriber` directly.
24 * If you have a specific use case, please file an issue.
25 */
26 static create<T>(next?: (x?: T) => void, error?: (e?: any) => void, complete?: () => void): Subscriber<T>;
27 /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */
28 protected isStopped: boolean;
29 /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */
30 protected destination: Subscriber<any> | Observer<any>;
31 /**
32 * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.
33 * There is no reason to directly create an instance of Subscriber. This type is exported for typings reasons.
34 */
35 constructor(destination?: Subscriber<any> | Observer<any>);
36 /**
37 * The {@link Observer} callback to receive notifications of type `next` from
38 * the Observable, with a value. The Observable may call this method 0 or more
39 * times.
40 * @param value The `next` value.
41 */
42 next(value: T): void;
43 /**
44 * The {@link Observer} callback to receive notifications of type `error` from
45 * the Observable, with an attached `Error`. Notifies the Observer that
46 * the Observable has experienced an error condition.
47 * @param err The `error` exception.
48 */
49 error(err?: any): void;
50 /**
51 * The {@link Observer} callback to receive a valueless notification of type
52 * `complete` from the Observable. Notifies the Observer that the Observable
53 * has finished sending push-based notifications.
54 */
55 complete(): void;
56 unsubscribe(): void;
57 protected _next(value: T): void;
58 protected _error(err: any): void;
59 protected _complete(): void;
60 }
61 export declare class SafeSubscriber<T> extends Subscriber<T> {
62 constructor(observerOrNext?: Partial<Observer<T>> | ((value: T) => void) | null, error?: ((e?: any) => void) | null, complete?: (() => void) | null);
63 }
64 /**
65 * The observer used as a stub for subscriptions where the user did not
66 * pass any arguments to `subscribe`. Comes with the default error handling
67 * behavior.
68 */
69 export declare const EMPTY_OBSERVER: Readonly<Observer<any>> & {
70 closed: true;
71 };
72 //# sourceMappingURL=Subscriber.d.ts.map