forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rx.d.ts
67 lines (58 loc) · 3.29 KB
/
rx.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// Type definitions for RxJS v2.5.3
// Project: http://rx.codeplex.com/
// Definitions by: gsino <http://www.codeplex.com/site/users/view/gsino>, Igor Oleinikov <https://github.com/Igorbek>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
///<reference path="rx-lite.d.ts"/>
declare module Rx {
export interface IScheduler {
catch(handler: (exception: any) => boolean): IScheduler;
catchException(handler: (exception: any) => boolean): IScheduler;
}
// Observer
export interface Observer<T> {
checked(): Observer<any>;
}
interface ObserverStatic {
/**
* Schedules the invocation of observer methods on the given scheduler.
* @param scheduler Scheduler to schedule observer messages on.
* @returns Observer whose messages are scheduled on the given scheduler.
*/
notifyOn<T>(scheduler: IScheduler): Observer<T>;
}
export interface Observable<T> {
observeOn(scheduler: IScheduler): Observable<T>;
subscribeOn(scheduler: IScheduler): Observable<T>;
amb(rightSource: Observable<T>): Observable<T>;
amb(rightSource: IPromise<T>): Observable<T>;
onErrorResumeNext(second: Observable<T>): Observable<T>;
onErrorResumeNext(second: IPromise<T>): Observable<T>;
bufferWithCount(count: number, skip?: number): Observable<T[]>;
windowWithCount(count: number, skip?: number): Observable<Observable<T>>;
defaultIfEmpty(defaultValue?: T): Observable<T>;
distinct(skipParameter: boolean, valueSerializer: (value: T) => string): Observable<T>;
distinct<TKey>(keySelector?: (value: T) => TKey, keySerializer?: (key: TKey) => string): Observable<T>;
groupBy<TKey, TElement>(keySelector: (value: T) => TKey, skipElementSelector?: boolean, keySerializer?: (key: TKey) => string): Observable<GroupedObservable<TKey, T>>;
groupBy<TKey, TElement>(keySelector: (value: T) => TKey, elementSelector: (value: T) => TElement, keySerializer?: (key: TKey) => string): Observable<GroupedObservable<TKey, TElement>>;
groupByUntil<TKey, TDuration>(keySelector: (value: T) => TKey, skipElementSelector: boolean, durationSelector: (group: GroupedObservable<TKey, T>) => Observable<TDuration>, keySerializer?: (key: TKey) => string): Observable<GroupedObservable<TKey, T>>;
groupByUntil<TKey, TElement, TDuration>(keySelector: (value: T) => TKey, elementSelector: (value: T) => TElement, durationSelector: (group: GroupedObservable<TKey, TElement>) => Observable<TDuration>, keySerializer?: (key: TKey) => string): Observable<GroupedObservable<TKey, TElement>>;
}
interface ObservableStatic {
using<TSource, TResource extends IDisposable>(resourceFactory: () => TResource, observableFactory: (resource: TResource) => Observable<TSource>): Observable<TSource>;
amb<T>(...sources: Observable<T>[]): Observable<T>;
amb<T>(...sources: IPromise<T>[]): Observable<T>;
amb<T>(sources: Observable<T>[]): Observable<T>;
amb<T>(sources: IPromise<T>[]): Observable<T>;
onErrorResumeNext<T>(...sources: Observable<T>[]): Observable<T>;
onErrorResumeNext<T>(...sources: IPromise<T>[]): Observable<T>;
onErrorResumeNext<T>(sources: Observable<T>[]): Observable<T>;
onErrorResumeNext<T>(sources: IPromise<T>[]): Observable<T>;
}
interface GroupedObservable<TKey, TElement> extends Observable<TElement> {
key: TKey;
underlyingObservable: Observable<TElement>;
}
}
declare module "rx" {
export = Rx
}