1 | declare namespace Rx {
|
2 | |
3 |
|
4 |
|
5 | interface IPromise<T> {
|
6 | then<R>(onFulfilled: (value: T) => IPromise<R>, onRejected: (reason: any) => IPromise<R>): IPromise<R>;
|
7 | then<R>(onFulfilled: (value: T) => IPromise<R>, onRejected?: (reason: any) => R): IPromise<R>;
|
8 | then<R>(onFulfilled: (value: T) => R, onRejected: (reason: any) => IPromise<R>): IPromise<R>;
|
9 | then<R>(onFulfilled?: (value: T) => R, onRejected?: (reason: any) => R): IPromise<R>;
|
10 | }
|
11 |
|
12 | interface IDisposable {
|
13 | dispose(): void;
|
14 | }
|
15 |
|
16 | interface IScheduler {
|
17 | catch(handler: (exception: any) => boolean): IScheduler;
|
18 | catchException(handler: (exception: any) => boolean): IScheduler;
|
19 | }
|
20 |
|
21 | // Observer
|
22 | interface Observer<T> {
|
23 | checked(): Observer<any>;
|
24 | }
|
25 |
|
26 | interface ObserverStatic {
|
27 | /**
|
28 | * Schedules the invocation of observer methods on the given scheduler.
|
29 | * @param scheduler Scheduler to schedule observer messages on.
|
30 | * @returns Observer whose messages are scheduled on the given scheduler.
|
31 | */
|
32 | notifyOn<T>(scheduler: IScheduler): Observer<T>;
|
33 | }
|
34 |
|
35 | interface Observable<T> {
|
36 | observeOn(scheduler: IScheduler): Observable<T>;
|
37 | subscribeOn(scheduler: IScheduler): Observable<T>;
|
38 |
|
39 | amb(rightSource: IPromise<T> | Observable<T>): Observable<T>;
|
40 | onErrorResumeNext(second: IPromise<T> | Observable<T>): Observable<T>;
|
41 | bufferWithCount(count: number, skip?: number): Observable<T[]>;
|
42 | windowWithCount(count: number, skip?: number): Observable<Observable<T>>;
|
43 | defaultIfEmpty(defaultValue?: T): Observable<T>;
|
44 | distinct(skipParameter: boolean, valueSerializer: (value: T) => string): Observable<T>;
|
45 | distinct<TKey>(keySelector?: (value: T) => TKey, keySerializer?: (key: TKey) => string): Observable<T>;
|
46 | groupBy<TKey, TElement>(
|
47 | keySelector: (value: T) => TKey,
|
48 | skipElementSelector?: boolean,
|
49 | keySerializer?: (key: TKey) => string,
|
50 | ): Observable<GroupedObservable<TKey, T>>;
|
51 | groupBy<TKey, TElement>(
|
52 | keySelector: (value: T) => TKey,
|
53 | elementSelector: (value: T) => TElement,
|
54 | keySerializer?: (key: TKey) => string,
|
55 | ): Observable<GroupedObservable<TKey, TElement>>;
|
56 | groupByUntil<TKey, TDuration>(
|
57 | keySelector: (value: T) => TKey,
|
58 | skipElementSelector: boolean,
|
59 | durationSelector: (group: GroupedObservable<TKey, T>) => Observable<TDuration>,
|
60 | keySerializer?: (key: TKey) => string,
|
61 | ): Observable<GroupedObservable<TKey, T>>;
|
62 | groupByUntil<TKey, TElement, TDuration>(
|
63 | keySelector: (value: T) => TKey,
|
64 | elementSelector: (value: T) => TElement,
|
65 | durationSelector: (group: GroupedObservable<TKey, TElement>) => Observable<TDuration>,
|
66 | keySerializer?: (key: TKey) => string,
|
67 | ): Observable<GroupedObservable<TKey, TElement>>;
|
68 | }
|
69 |
|
70 | interface ObservableStatic {
|
71 | using<TSource, TResource extends IDisposable>(
|
72 | resourceFactory: () => TResource,
|
73 | observableFactory: (resource: TResource) => Observable<TSource>,
|
74 | ): Observable<TSource>;
|
75 | amb<T>(...sources: Array<IPromise<T>>): Observable<T>;
|
76 | amb<T>(...sources: Array<Observable<T>>): Observable<T>;
|
77 | amb<T>(sources: Array<IPromise<T>> | Array<Observable<T>>): Observable<T>;
|
78 | onErrorResumeNext<T>(...sources: Array<IPromise<T>>): Observable<T>;
|
79 | onErrorResumeNext<T>(...sources: Array<Observable<T>>): Observable<T>;
|
80 | onErrorResumeNext<T>(sources: Array<IPromise<T>> | Array<Observable<T>>): Observable<T>;
|
81 | }
|
82 |
|
83 | interface GroupedObservable<TKey, TElement> extends Observable<TElement> {
|
84 | key: TKey;
|
85 | underlyingObservable: Observable<TElement>;
|
86 | }
|
87 | }
|
88 |
|
89 | declare module "rx-core" {
|
90 | export = Rx;
|
91 | }
|
92 |
|
\ | No newline at end of file |