// DefinitelyTyped: partial
// This file contains common part of defintions for rx.async.d.ts and rx.lite.d.ts
// Do not include the file separately.
///
declare module Rx {
export module config {
/**
* Configuration option to determine whether to use native events only
*/
export var useNativeEvents: boolean;
}
interface ObservableStatic {
/**
* Invokes the asynchronous function, surfacing the result through an observable sequence.
* @param functionAsync Asynchronous function which returns a Promise to run.
* @returns An observable sequence exposing the function's result value, or an exception.
*/
startAsync(functionAsync: () => IPromise): Observable;
fromCallback: {
// with single result callback without selector
(func: (callback: (result: TResult) => any) => any, context?: any): () => Observable;
(func: (arg1: T1, callback: (result: TResult) => any) => any, context?: any): (arg1: T1) => Observable;
(func: (arg1: T1, arg2: T2, callback: (result: TResult) => any) => any, context?: any): (arg1: T1, arg2: T2) => Observable;
(func: (arg1: T1, arg2: T2, arg3: T3, callback: (result: TResult) => any) => any, context?: any): (arg1: T1, arg2: T2, arg3: T3) => Observable;
// with any callback with selector
(func: (callback: Function) => any, context: any, selector: (args: TCallbackResult[]) => TResult): () => Observable;
(func: (arg1: T1, callback: Function) => any, context: any, selector: (args: TCallbackResult[]) => TResult): (arg1: T1) => Observable;
(func: (arg1: T1, arg2: T2, callback: Function) => any, context: any, selector: (args: TCallbackResult[]) => TResult): (arg1: T1, arg2: T2) => Observable;
(func: (arg1: T1, arg2: T2, arg3: T3, callback: Function) => any, context: any, selector: (args: TCallbackResult[]) => TResult): (arg1: T1, arg2: T2, arg3: T3) => Observable;
// with any callback without selector
(func: (callback: Function) => any, context?: any): () => Observable;
(func: (arg1: T1, callback: Function) => any, context?: any): (arg1: T1) => Observable;
(func: (arg1: T1, arg2: T2, callback: Function) => any, context?: any): (arg1: T1, arg2: T2) => Observable;
(func: (arg1: T1, arg2: T2, arg3: T3, callback: Function) => any, context?: any): (arg1: T1, arg2: T2, arg3: T3) => Observable;
// with any function with selector
(func: Function, context: any, selector: (args: TCallbackResult[]) => TResult): (...args: any[]) => Observable;
// with any function without selector
(func: Function, context?: any): (...args: any[]) => Observable;
};
fromNodeCallback: {
// with single result callback without selector
(func: (callback: (err: any, result: T) => any) => any, context?: any): () => Observable;
(func: (arg1: T1, callback: (err: any, result: T) => any) => any, context?: any): (arg1: T1) => Observable;
(func: (arg1: T1, arg2: T2, callback: (err: any, result: T) => any) => any, context?: any): (arg1: T1, arg2: T2) => Observable;
(func: (arg1: T1, arg2: T2, arg3: T3, callback: (err: any, result: T) => any) => any, context?: any): (arg1: T1, arg2: T2, arg3: T3) => Observable;
// with any callback with selector
(func: (callback: Function) => any, context: any, selector: (results: TC[]) => TR): () => Observable;
(func: (arg1: T1, callback: Function) => any, context: any, selector: (results: TC[]) => TR): (arg1: T1) => Observable;
(func: (arg1: T1, arg2: T2, callback: Function) => any, context: any, selector: (results: TC[]) => TR): (arg1: T1, arg2: T2) => Observable;
(func: (arg1: T1, arg2: T2, arg3: T3, callback: Function) => any, context: any, selector: (results: TC[]) => TR): (arg1: T1, arg2: T2, arg3: T3) => Observable;
// with any callback without selector
(func: (callback: Function) => any, context?: any): () => Observable
;
(func: (arg1: T1, callback: Function) => any, context?: any): (arg1: T1) => Observable;
(func: (arg1: T1, arg2: T2, callback: Function) => any, context?: any): (arg1: T1, arg2: T2) => Observable;
(func: (arg1: T1, arg2: T2, arg3: T3, callback: Function) => any, context?: any): (arg1: T1, arg2: T2, arg3: T3) => Observable;
// with any function with selector
(func: Function, context: any, selector: (results: TC[]) => T): (...args: any[]) => Observable;
// with any function without selector
(func: Function, context?: any): (...args: any[]) => Observable;
};
fromEvent(element: NodeList, eventName: string, selector?: (arguments: any[]) => T): Observable;
fromEvent(element: Node, eventName: string, selector?: (arguments: any[]) => T): Observable;
fromEventPattern(addHandler: (handler: Function) => void, removeHandler: (handler: Function) => void, selector?: (arguments: any[])=>T): Observable;
}
}