UNPKG

2.54 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 /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */
14 observers: Observer<T>[];
15 /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */
16 isStopped: boolean;
17 /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */
18 hasError: boolean;
19 /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */
20 thrownError: any;
21 /**
22 * Creates a "subject" by basically gluing an observer to an observable.
23 *
24 * @nocollapse
25 * @deprecated Recommended you do not use. Will be removed at some point in the future. Plans for replacement still under discussion.
26 */
27 static create: (...args: any[]) => any;
28 constructor();
29 /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */
30 lift<R>(operator: Operator<T, R>): Observable<R>;
31 next(value: T): void;
32 error(err: any): void;
33 complete(): void;
34 unsubscribe(): void;
35 get observed(): boolean;
36 /**
37 * Creates a new Observable with this Subject as the source. You can do this
38 * to create customize Observer-side logic of the Subject and conceal it from
39 * code that uses the Observable.
40 * @return {Observable} Observable that the Subject casts to
41 */
42 asObservable(): Observable<T>;
43}
44/**
45 * @class AnonymousSubject<T>
46 */
47export declare class AnonymousSubject<T> extends Subject<T> {
48 /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */
49 destination?: Observer<T> | undefined;
50 constructor(
51 /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */
52 destination?: Observer<T> | undefined, source?: Observable<T>);
53 next(value: T): void;
54 error(err: any): void;
55 complete(): void;
56}
57//# sourceMappingURL=Subject.d.ts.map
\No newline at end of file