///
///
///
module Rx {
export module config {
export var Promise: { new (resolver: (resolvePromise: (value: T) => void, rejectPromise: (reason: any) => void) => void): IPromise; };
}
export module helpers {
export var noop: () => void;
export var notDefined: (value: any) => boolean;
export var identity: (value: T) => T;
export var defaultNow: () => number;
export var defaultComparer: (left: any, right: any) => boolean;
export var defaultSubComparer: (left: any, right: any) => number;
export var defaultKeySerializer: (key: any) => string;
export var defaultError: (err: any) => void;
export var isPromise: (p: any) => boolean;
export var asArray: (...args: T[]) => T[];
export var not: (value: any) => boolean;
export var isFunction: (value: any) => boolean;
}
export type _Selector = (value: T, index: number, observable: Observable) => TResult;
export type _ValueOrSelector = TResult | _Selector;
export type _Predicate = _Selector;
export type _Comparer = (value1: T, value2: T) => TResult;
export type _Accumulator = (acc: TAcc, value: T) => TAcc;
export module special {
export type _FlatMapResultSelector = (value: T1, selectorValue: T2, index: number, selectorOther: number) => TResult;
}
export interface IObservable {
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribe(observer: IObserver): IDisposable;
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribe(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): IDisposable;
}
export interface Observable {
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribe(observer: IObserver): IDisposable;
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribe(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): IDisposable;
/**
* Subscribes to the next value in the sequence with an optional "this" argument.
* @param {Function} onNext The function to invoke on each element in the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribeOnNext(onNext: (value: T) => void, thisArg?: any): IDisposable;
/**
* Subscribes to an exceptional condition in the sequence with an optional "this" argument.
* @param {Function} onError The function to invoke upon exceptional termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribeOnError(onError: (exception: any) => void, thisArg?: any): IDisposable;
/**
* Subscribes to the next value in the sequence with an optional "this" argument.
* @param {Function} onCompleted The function to invoke upon graceful termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
subscribeOnCompleted(onCompleted: () => void, thisArg?: any): IDisposable;
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
forEach(observer: IObserver): IDisposable;
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
forEach(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): IDisposable;
}
export interface ObservableStatic {
/**
* Determines whether the given object is an Observable
* @param {Any} An object to determine whether it is an Observable
* @returns {Boolean} true if an Observable, else false.
*/
isObservable(o: any): boolean;
}
export var Observable: ObservableStatic;
}
(function() {
var observer: Rx.IObserver;
var observable: Rx.Observable;
observable.subscribe(observer);
observable.subscribe((v) => {});
observable.subscribe((v) => {}, (e) => {});
observable.subscribe((v) => {}, (e) => {}, () => {});
observable.subscribeOnNext((v) => {});
observable.subscribeOnNext((v) => {}, {});
observable.subscribeOnError((v) => {});
observable.subscribeOnError((v) => {}, {});
observable.subscribeOnCompleted(() => {});
observable.subscribeOnCompleted(() => {}, {});
observable.forEach(observer);
observable.forEach((v) => {});
observable.forEach((v) => {}, (e) => {});
observable.forEach((v) => {}, (e) => {}, () => {});
Rx.Observable.isObservable({});
});