UNPKG

2.57 kBTypeScriptView Raw
1import { Operator } from './Operator';
2import { Observable } from './Observable';
3import { Observer, SubscriptionLike } from './types';
4/**
5 * A Subject is a special type of Observable that allows values to be
6 * multicasted to many Observers. Subjects are like EventEmitters.
7 *
8 * Every Subject is an Observable and an Observer. You can subscribe to a
9 * Subject, and you can call next to feed values as well as error and complete.
10 */
11export declare class Subject<T> extends Observable<T> implements SubscriptionLike {
12 closed: boolean;
13 private currentObservers;
14 /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */
15 observers: Observer<T>[];
16 /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */
17 isStopped: boolean;
18 /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */
19 hasError: boolean;
20 /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */
21 thrownError: any;
22 /**
23 * Creates a "subject" by basically gluing an observer to an observable.
24 *
25 * @nocollapse
26 * @deprecated Recommended you do not use. Will be removed at some point in the future. Plans for replacement still under discussion.
27 */
28 static create: (...args: any[]) => any;
29 constructor();
30 /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */
31 lift<R>(operator: Operator<T, R>): Observable<R>;
32 next(value: T): void;
33 error(err: any): void;
34 complete(): void;
35 unsubscribe(): void;
36 get observed(): boolean;
37 /**
38 * Creates a new Observable with this Subject as the source. You can do this
39 * to create custom Observer-side logic of the Subject and conceal it from
40 * code that uses the Observable.
41 * @return {Observable} Observable that the Subject casts to
42 */
43 asObservable(): Observable<T>;
44}
45/**
46 * @class AnonymousSubject<T>
47 */
48export declare class AnonymousSubject<T> extends Subject<T> {
49 /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */
50 destination?: Observer<T> | undefined;
51 constructor(
52 /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */
53 destination?: Observer<T> | undefined, source?: Observable<T>);
54 next(value: T): void;
55 error(err: any): void;
56 complete(): void;
57}
58//# sourceMappingURL=Subject.d.ts.map
\No newline at end of file