// DefinitelyTyped: partial // This file contains common part of defintions for rx.d.ts and rx.lite.d.ts // Do not include the file separately. declare module Rx { export module internals { function isEqual(left: any, right: any): boolean; function addRef(xs: Observable, r: { getDisposable(): IDisposable; }): Observable; // Priority Queue for Scheduling export class PriorityQueue { constructor(capacity: number); length: number; isHigherPriority(left: number, right: number): boolean; percolate(index: number): void; heapify(index: number): void; peek(): ScheduledItem; removeAt(index: number): void; dequeue(): ScheduledItem; enqueue(item: ScheduledItem): void; remove(item: ScheduledItem): boolean; static count: number; } export class ScheduledItem { constructor(scheduler: IScheduler, state: any, action: (scheduler: IScheduler, state: any) => IDisposable, dueTime: TTime, comparer?: (x: TTime, y: TTime) => number); scheduler: IScheduler; state: TTime; action: (scheduler: IScheduler, state: any) => IDisposable; dueTime: TTime; comparer: (x: TTime, y: TTime) => number; disposable: SingleAssignmentDisposable; invoke(): void; compareTo(other: ScheduledItem): number; isCancelled(): boolean; invokeCore(): IDisposable; } } export module config { export var Promise: { new (resolver: (resolvePromise: (value: T) => void, rejectPromise: (reason: any) => void) => void): IPromise; }; } export module helpers { function noop(): void; function notDefined(value: any): boolean; function identity(value: T): T; function defaultNow(): number; function defaultComparer(left: any, right: any): boolean; function defaultSubComparer(left: any, right: any): number; function defaultKeySerializer(key: any): string; function defaultError(err: any): void; function isPromise(p: any): boolean; function asArray(...args: T[]): T[]; function not(value: any): boolean; function isFunction(value: any): boolean; } export interface IDisposable { dispose(): void; } export class CompositeDisposable implements IDisposable { constructor (...disposables: IDisposable[]); constructor (disposables: IDisposable[]); isDisposed: boolean; length: number; dispose(): void; add(item: IDisposable): void; remove(item: IDisposable): boolean; toArray(): IDisposable[]; } export class Disposable implements IDisposable { constructor(action: () => void); static create(action: () => void): IDisposable; static empty: IDisposable; dispose(): void; } // Single assignment export class SingleAssignmentDisposable implements IDisposable { constructor(); isDisposed: boolean; current: IDisposable; dispose(): void ; getDisposable(): IDisposable; setDisposable(value: IDisposable): void ; } // SerialDisposable it's an alias of SingleAssignmentDisposable export class SerialDisposable extends SingleAssignmentDisposable { constructor(); } export class RefCountDisposable implements IDisposable { constructor(disposable: IDisposable); dispose(): void; isDisposed: boolean; getDisposable(): IDisposable; } export interface IScheduler { now(): number; isScheduler(value: any): boolean; schedule(action: () => void): IDisposable; scheduleWithState(state: TState, action: (scheduler: IScheduler, state: TState) => IDisposable): IDisposable; scheduleWithAbsolute(dueTime: number, action: () => void): IDisposable; scheduleWithAbsoluteAndState(state: TState, dueTime: number, action: (scheduler: IScheduler, state: TState) =>IDisposable): IDisposable; scheduleWithRelative(dueTime: number, action: () => void): IDisposable; scheduleWithRelativeAndState(state: TState, dueTime: number, action: (scheduler: IScheduler, state: TState) =>IDisposable): IDisposable; scheduleRecursive(action: (action: () =>void ) =>void ): IDisposable; scheduleRecursiveWithState(state: TState, action: (state: TState, action: (state: TState) =>void ) =>void ): IDisposable; scheduleRecursiveWithAbsolute(dueTime: number, action: (action: (dueTime: number) => void) => void): IDisposable; scheduleRecursiveWithAbsoluteAndState(state: TState, dueTime: number, action: (state: TState, action: (state: TState, dueTime: number) => void) => void): IDisposable; scheduleRecursiveWithRelative(dueTime: number, action: (action: (dueTime: number) =>void ) =>void ): IDisposable; scheduleRecursiveWithRelativeAndState(state: TState, dueTime: number, action: (state: TState, action: (state: TState, dueTime: number) =>void ) =>void ): IDisposable; schedulePeriodic(period: number, action: () => void): IDisposable; schedulePeriodicWithState(state: TState, period: number, action: (state: TState) => TState): IDisposable; } export interface Scheduler extends IScheduler { } export interface SchedulerStatic { new ( now: () => number, schedule: (state: any, action: (scheduler: IScheduler, state: any) => IDisposable) => IDisposable, scheduleRelative: (state: any, dueTime: number, action: (scheduler: IScheduler, state: any) => IDisposable) => IDisposable, scheduleAbsolute: (state: any, dueTime: number, action: (scheduler: IScheduler, state: any) => IDisposable) => IDisposable): Scheduler; normalize(timeSpan: number): number; immediate: IScheduler; currentThread: ICurrentThreadScheduler; default: IScheduler; // alias for Scheduler.timeout timeout: IScheduler; } export var Scheduler: SchedulerStatic; // Current Thread IScheduler interface ICurrentThreadScheduler extends IScheduler { scheduleRequired(): boolean; } // Notifications export class Notification { accept(observer: IObserver): void; accept(onNext: (value: T) => TResult, onError?: (exception: any) => TResult, onCompleted?: () => TResult): TResult; toObservable(scheduler?: IScheduler): Observable; hasValue: boolean; equals(other: Notification): boolean; kind: string; value: T; exception: any; static createOnNext(value: T): Notification; static createOnError(exception: any): Notification; static createOnCompleted(): Notification; } /** * Promise A+ */ export interface IPromise { then(onFulfilled: (value: T) => IPromise, onRejected: (reason: any) => IPromise): IPromise; then(onFulfilled: (value: T) => IPromise, onRejected?: (reason: any) => R): IPromise; then(onFulfilled: (value: T) => R, onRejected: (reason: any) => IPromise): IPromise; then(onFulfilled?: (value: T) => R, onRejected?: (reason: any) => R): IPromise; } // Observer export interface IObserver { onNext(value: T): void; onError(exception: any): void; onCompleted(): void; } export interface Observer extends IObserver { toNotifier(): (notification: Notification) => void; asObserver(): Observer; } interface ObserverStatic { create(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): Observer; fromNotifier(handler: (notification: Notification, thisArg?: any) => void): Observer; } export var Observer: ObserverStatic; export interface IObservable { subscribe(observer: Observer): IDisposable; subscribe(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): IDisposable; subscribeOnNext(onNext: (value: T) => void, thisArg?: any): IDisposable; subscribeOnError(onError: (exception: any) => void, thisArg?: any): IDisposable; subscribeOnCompleted(onCompleted: () => void, thisArg?: any): IDisposable; } export interface Observable extends IObservable { forEach(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): IDisposable; // alias for subscribe toArray(): Observable; catch(handler: (exception: any) => Observable): Observable; catchException(handler: (exception: any) => Observable): Observable; // alias for catch catch(handler: (exception: any) => IPromise): Observable; catchException(handler: (exception: any) => IPromise): Observable; // alias for catch catch(second: Observable): Observable; catchException(second: Observable): Observable; // alias for catch combineLatest(second: Observable, resultSelector: (v1: T, v2: T2) => TResult): Observable; combineLatest(second: IPromise, resultSelector: (v1: T, v2: T2) => TResult): Observable; combineLatest(second: Observable, third: Observable, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; combineLatest(second: Observable, third: IPromise, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; combineLatest(second: IPromise, third: Observable, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; combineLatest(second: IPromise, third: IPromise, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; combineLatest(second: Observable, third: Observable, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; combineLatest(second: Observable, third: Observable, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; combineLatest(second: Observable, third: IPromise, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; combineLatest(second: Observable, third: IPromise, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; combineLatest(second: IPromise, third: Observable, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; combineLatest(second: IPromise, third: Observable, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; combineLatest(second: IPromise, third: IPromise, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; combineLatest(second: IPromise, third: IPromise, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; combineLatest(second: Observable, third: Observable, fourth: Observable, fifth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4, v5: T5) => TResult): Observable; combineLatest(souces: Observable[], resultSelector: (firstValue: T, ...otherValues: TOther[]) => TResult): Observable; combineLatest(souces: IPromise[], resultSelector: (firstValue: T, ...otherValues: TOther[]) => TResult): Observable; withLatestFrom(second: Observable, resultSelector: (v1: T, v2: T2) => TResult): Observable; withLatestFrom(second: IPromise, resultSelector: (v1: T, v2: T2) => TResult): Observable; withLatestFrom(second: Observable, third: Observable, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; withLatestFrom(second: Observable, third: IPromise, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; withLatestFrom(second: IPromise, third: Observable, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; withLatestFrom(second: IPromise, third: IPromise, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; withLatestFrom(second: Observable, third: Observable, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; withLatestFrom(second: Observable, third: Observable, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; withLatestFrom(second: Observable, third: IPromise, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; withLatestFrom(second: Observable, third: IPromise, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; withLatestFrom(second: IPromise, third: Observable, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; withLatestFrom(second: IPromise, third: Observable, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; withLatestFrom(second: IPromise, third: IPromise, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; withLatestFrom(second: IPromise, third: IPromise, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; withLatestFrom(second: Observable, third: Observable, fourth: Observable, fifth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4, v5: T5) => TResult): Observable; withLatestFrom(souces: Observable[], resultSelector: (firstValue: T, ...otherValues: TOther[]) => TResult): Observable; withLatestFrom(souces: IPromise[], resultSelector: (firstValue: T, ...otherValues: TOther[]) => TResult): Observable; concat(...sources: Observable[]): Observable; concat(...sources: IPromise[]): Observable; concat(sources: Observable[]): Observable; concat(sources: IPromise[]): Observable; concatAll(): T; concatObservable(): T; // alias for concatAll concatMap(selector: (value: T, index: number) => Observable, resultSelector: (value1: T, value2: T2, index: number) => R): Observable; // alias for selectConcat concatMap(selector: (value: T, index: number) => IPromise, resultSelector: (value1: T, value2: T2, index: number) => R): Observable; // alias for selectConcat concatMap(selector: (value: T, index: number) => Observable): Observable; // alias for selectConcat concatMap(selector: (value: T, index: number) => IPromise): Observable; // alias for selectConcat concatMap(sequence: Observable): Observable; // alias for selectConcat merge(maxConcurrent: number): T; merge(other: Observable): Observable; merge(other: IPromise): Observable; mergeAll(): T; mergeObservable(): T; // alias for mergeAll skipUntil(other: Observable): Observable; skipUntil(other: IPromise): Observable; switch(): T; switchLatest(): T; // alias for switch takeUntil(other: Observable): Observable; takeUntil(other: IPromise): Observable; zip(second: Observable, resultSelector: (v1: T, v2: T2) => TResult): Observable; zip(second: IPromise, resultSelector: (v1: T, v2: T2) => TResult): Observable; zip(second: Observable, third: Observable, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; zip(second: Observable, third: IPromise, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; zip(second: IPromise, third: Observable, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; zip(second: IPromise, third: IPromise, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; zip(second: Observable, third: Observable, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; zip(second: Observable, third: Observable, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; zip(second: Observable, third: IPromise, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; zip(second: Observable, third: IPromise, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; zip(second: IPromise, third: Observable, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; zip(second: IPromise, third: Observable, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; zip(second: IPromise, third: IPromise, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; zip(second: IPromise, third: IPromise, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; zip(second: Observable, third: Observable, fourth: Observable, fifth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4, v5: T5) => TResult): Observable; zip(second: Observable[], resultSelector: (left: T, ...right: TOther[]) => TResult): Observable; zip(second: IPromise[], resultSelector: (left: T, ...right: TOther[]) => TResult): Observable; asObservable(): Observable; dematerialize(): Observable; distinctUntilChanged(skipParameter: boolean, comparer: (x: T, y: T) => boolean): Observable; distinctUntilChanged(keySelector?: (value: T) => TValue, comparer?: (x: TValue, y: TValue) => boolean): Observable; do(observer: Observer): Observable; doAction(observer: Observer): Observable; // alias for do tap(observer: Observer): Observable; // alias for do do(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): Observable; doAction(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): Observable; // alias for do tap(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): Observable; // alias for do doOnNext(onNext: (value: T) => void, thisArg?: any): Observable; doOnError(onError: (exception: any) => void, thisArg?: any): Observable; doOnCompleted(onCompleted: () => void, thisArg?: any): Observable; tapOnNext(onNext: (value: T) => void, thisArg?: any): Observable; tapOnError(onError: (exception: any) => void, thisArg?: any): Observable; tapOnCompleted(onCompleted: () => void, thisArg?: any): Observable; finally(action: () => void): Observable; finallyAction(action: () => void): Observable; // alias for finally ignoreElements(): Observable; materialize(): Observable>; repeat(repeatCount?: number): Observable; retry(retryCount?: number): Observable; /** * Applies an accumulator function over an observable sequence and returns each intermediate result. The optional seed value is used as the initial accumulator value. * For aggregation behavior with no intermediate results, see Observable.aggregate. * @example * var res = source.scan(function (acc, x) { return acc + x; }); * var res = source.scan(function (acc, x) { return acc + x; }, 0); * @param accumulator An accumulator function to be invoked on each element. * @param seed The initial accumulator value. * @returns An observable sequence containing the accumulated values. */ scan(accumulator: (acc: TAcc, value: T, index?: number, source?: Observable) => TAcc, seed: TAcc): Observable; scan(accumulator: (acc: T, value: T, index?: number, source?: Observable) => T): Observable; skipLast(count: number): Observable; startWith(...values: T[]): Observable; startWith(scheduler: IScheduler, ...values: T[]): Observable; takeLast(count: number): Observable; takeLastBuffer(count: number): Observable; select(selector: (value: T, index: number, source: Observable) => TResult, thisArg?: any): Observable; map(selector: (value: T, index: number, source: Observable) => TResult, thisArg?: any): Observable; // alias for select pluck(prop: string): Observable; selectMany(selector: (value: T) => Observable, resultSelector: (item: T, other: TOther) => TResult): Observable; selectMany(selector: (value: T) => IPromise, resultSelector: (item: T, other: TOther) => TResult): Observable; selectMany(selector: (value: T) => Observable): Observable; selectMany(selector: (value: T) => IPromise): Observable; selectMany(other: Observable): Observable; selectMany(other: IPromise): Observable; selectMany(selector: (value: T) => TResult[]): Observable; // alias for selectMany flatMap(selector: (value: T) => Observable, resultSelector: (item: T, other: TOther) => TResult): Observable; // alias for selectMany flatMap(selector: (value: T) => IPromise, resultSelector: (item: T, other: TOther) => TResult): Observable; // alias for selectMany flatMap(selector: (value: T) => Observable): Observable; // alias for selectMany flatMap(selector: (value: T) => IPromise): Observable; // alias for selectMany flatMap(other: Observable): Observable; // alias for selectMany flatMap(other: IPromise): Observable; // alias for selectMany flatMap(selector: (value: T) => TResult[]): Observable; // alias for selectMany /** * Projects each notification of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence. * @param {Function} onNext A transform function to apply to each element; the second parameter of the function represents the index of the source element. * @param {Function} onError A transform function to apply when an error occurs in the source sequence. * @param {Function} onCompleted A transform function to apply when the end of the source sequence is reached. * @param {Any} [thisArg] An optional "this" to use to invoke each transform. * @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function corresponding to each notification in the input sequence. */ selectManyObserver(onNext: (value: T, index: number) => Observable, onError: (exception: any) => Observable, onCompleted: () => Observable, thisArg?: any): Observable; /** * Projects each notification of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence. * @param {Function} onNext A transform function to apply to each element; the second parameter of the function represents the index of the source element. * @param {Function} onError A transform function to apply when an error occurs in the source sequence. * @param {Function} onCompleted A transform function to apply when the end of the source sequence is reached. * @param {Any} [thisArg] An optional "this" to use to invoke each transform. * @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function corresponding to each notification in the input sequence. */ flatMapObserver(onNext: (value: T, index: number) => Observable, onError: (exception: any) => Observable, onCompleted: () => Observable, thisArg?: any): Observable; selectConcat(selector: (value: T, index: number) => Observable, resultSelector: (value1: T, value2: T2, index: number) => R): Observable; selectConcat(selector: (value: T, index: number) => IPromise, resultSelector: (value1: T, value2: T2, index: number) => R): Observable; selectConcat(selector: (value: T, index: number) => Observable): Observable; selectConcat(selector: (value: T, index: number) => IPromise): Observable; selectConcat(sequence: Observable): Observable; /** * Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then * transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence. * @param selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element. * @param [thisArg] Object to use as this when executing callback. * @returns An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences * and that at any point in time produces the elements of the most recent inner observable sequence that has been received. */ selectSwitch(selector: (value: T, index: number, source: Observable) => Observable, thisArg?: any): Observable; /** * Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then * transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence. * @param selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element. * @param [thisArg] Object to use as this when executing callback. * @returns An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences * and that at any point in time produces the elements of the most recent inner observable sequence that has been received. */ flatMapLatest(selector: (value: T, index: number, source: Observable) => Observable, thisArg?: any): Observable; // alias for selectSwitch /** * Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then * transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence. * @param selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element. * @param [thisArg] Object to use as this when executing callback. * @since 2.2.28 * @returns An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences * and that at any point in time produces the elements of the most recent inner observable sequence that has been received. */ switchMap(selector: (value: T, index: number, source: Observable) => TResult, thisArg?: any): Observable; // alias for selectSwitch skip(count: number): Observable; skipWhile(predicate: (value: T, index: number, source: Observable) => boolean, thisArg?: any): Observable; take(count: number, scheduler?: IScheduler): Observable; takeWhile(predicate: (value: T, index: number, source: Observable) => boolean, thisArg?: any): Observable; where(predicate: (value: T, index: number, source: Observable) => boolean, thisArg?: any): Observable; filter(predicate: (value: T, index: number, source: Observable) => boolean, thisArg?: any): Observable; // alias for where /** * Converts an existing observable sequence to an ES6 Compatible Promise * @example * var promise = Rx.Observable.return(42).toPromise(RSVP.Promise); * @param promiseCtor The constructor of the promise. * @returns An ES6 compatible promise with the last value from the observable sequence. */ toPromise>(promiseCtor: { new (resolver: (resolvePromise: (value: T) => void, rejectPromise: (reason: any) => void) => void): TPromise; }): TPromise; /** * Converts an existing observable sequence to an ES6 Compatible Promise * @example * var promise = Rx.Observable.return(42).toPromise(RSVP.Promise); * * // With config * Rx.config.Promise = RSVP.Promise; * var promise = Rx.Observable.return(42).toPromise(); * @param [promiseCtor] The constructor of the promise. If not provided, it looks for it in Rx.config.Promise. * @returns An ES6 compatible promise with the last value from the observable sequence. */ toPromise(promiseCtor?: { new (resolver: (resolvePromise: (value: T) => void, rejectPromise: (reason: any) => void) => void): IPromise; }): IPromise; // Experimental Flattening /** * Performs a exclusive waiting for the first to finish before subscribing to another observable. * Observables that come in between subscriptions will be dropped on the floor. * Can be applied on `Observable>` or `Observable>`. * @since 2.2.28 * @returns A exclusive observable with only the results that happen when subscribed. */ exclusive(): Observable; /** * Performs a exclusive map waiting for the first to finish before subscribing to another observable. * Observables that come in between subscriptions will be dropped on the floor. * Can be applied on `Observable>` or `Observable>`. * @since 2.2.28 * @param selector Selector to invoke for every item in the current subscription. * @param [thisArg] An optional context to invoke with the selector parameter. * @returns {An exclusive observable with only the results that happen when subscribed. */ exclusiveMap(selector: (value: I, index: number, source: Observable) => R, thisArg?: any): Observable; } interface ObservableStatic { create(subscribe: (observer: Observer) => IDisposable): Observable; create(subscribe: (observer: Observer) => () => void): Observable; create(subscribe: (observer: Observer) => void): Observable; createWithDisposable(subscribe: (observer: Observer) => IDisposable): Observable; defer(observableFactory: () => Observable): Observable; defer(observableFactory: () => IPromise): Observable; empty(scheduler?: IScheduler): Observable; /** * This method creates a new Observable sequence from an array object. * @param array An array-like or iterable object to convert to an Observable sequence. * @param mapFn Map function to call on every element of the array. * @param [thisArg] The context to use calling the mapFn if provided. * @param [scheduler] Optional scheduler to use for scheduling. If not provided, defaults to Scheduler.currentThread. */ from(array: T[], mapFn: (value: T, index: number) => TResult, thisArg?: any, scheduler?: IScheduler): Observable; /** * This method creates a new Observable sequence from an array object. * @param array An array-like or iterable object to convert to an Observable sequence. * @param [mapFn] Map function to call on every element of the array. * @param [thisArg] The context to use calling the mapFn if provided. * @param [scheduler] Optional scheduler to use for scheduling. If not provided, defaults to Scheduler.currentThread. */ from(array: T[], mapFn?: (value: T, index: number) => T, thisArg?: any, scheduler?: IScheduler): Observable; /** * This method creates a new Observable sequence from an array-like object. * @param array An array-like or iterable object to convert to an Observable sequence. * @param mapFn Map function to call on every element of the array. * @param [thisArg] The context to use calling the mapFn if provided. * @param [scheduler] Optional scheduler to use for scheduling. If not provided, defaults to Scheduler.currentThread. */ from(array: { length: number;[index: number]: T; }, mapFn: (value: T, index: number) => TResult, thisArg?: any, scheduler?: IScheduler): Observable; /** * This method creates a new Observable sequence from an array-like object. * @param array An array-like or iterable object to convert to an Observable sequence. * @param [mapFn] Map function to call on every element of the array. * @param [thisArg] The context to use calling the mapFn if provided. * @param [scheduler] Optional scheduler to use for scheduling. If not provided, defaults to Scheduler.currentThread. */ from(array: { length: number;[index: number]: T; }, mapFn?: (value: T, index: number) => T, thisArg?: any, scheduler?: IScheduler): Observable; /** * This method creates a new Observable sequence from an array-like or iterable object. * @param array An array-like or iterable object to convert to an Observable sequence. * @param [mapFn] Map function to call on every element of the array. * @param [thisArg] The context to use calling the mapFn if provided. * @param [scheduler] Optional scheduler to use for scheduling. If not provided, defaults to Scheduler.currentThread. */ from(iterable: any, mapFn?: (value: any, index: number) => T, thisArg?: any, scheduler?: IScheduler): Observable; fromArray(array: T[], scheduler?: IScheduler): Observable; fromArray(array: { length: number;[index: number]: T; }, scheduler?: IScheduler): Observable; generate(initialState: TState, condition: (state: TState) => boolean, iterate: (state: TState) => TState, resultSelector: (state: TState) => TResult, scheduler?: IScheduler): Observable; never(): Observable; /** * This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments. * * @example * var res = Rx.Observable.of(1, 2, 3); * @since 2.2.28 * @returns The observable sequence whose elements are pulled from the given arguments. */ of(...values: T[]): Observable; /** * This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments. * @example * var res = Rx.Observable.ofWithScheduler(Rx.Scheduler.timeout, 1, 2, 3); * @since 2.2.28 * @param [scheduler] A scheduler to use for scheduling the arguments. * @returns The observable sequence whose elements are pulled from the given arguments. */ ofWithScheduler(scheduler?: IScheduler, ...values: T[]): Observable; range(start: number, count: number, scheduler?: IScheduler): Observable; repeat(value: T, repeatCount?: number, scheduler?: IScheduler): Observable; return(value: T, scheduler?: IScheduler): Observable; /** * @since 2.2.28 */ just(value: T, scheduler?: IScheduler): Observable; // alias for return returnValue(value: T, scheduler?: IScheduler): Observable; // alias for return throw(exception: Error, scheduler?: IScheduler): Observable; throw(exception: any, scheduler?: IScheduler): Observable; throwException(exception: Error, scheduler?: IScheduler): Observable; // alias for throw throwException(exception: any, scheduler?: IScheduler): Observable; // alias for throw throwError(error: Error, scheduler?: IScheduler): Observable; // alias for throw throwError(error: any, scheduler?: IScheduler): Observable; // alias for throw catch(sources: Observable[]): Observable; catch(sources: IPromise[]): Observable; catchException(sources: Observable[]): Observable; // alias for catch catchException(sources: IPromise[]): Observable; // alias for catch catchError(sources: Observable[]): Observable; // alias for catch catchError(sources: IPromise[]): Observable; // alias for catch catch(...sources: Observable[]): Observable; catch(...sources: IPromise[]): Observable; catchException(...sources: Observable[]): Observable; // alias for catch catchException(...sources: IPromise[]): Observable; // alias for catch catchError(...sources: Observable[]): Observable; // alias for catch catchError(...sources: IPromise[]): Observable; // alias for catch combineLatest(first: Observable, second: Observable, resultSelector: (v1: T, v2: T2) => TResult): Observable; combineLatest(first: IPromise, second: Observable, resultSelector: (v1: T, v2: T2) => TResult): Observable; combineLatest(first: Observable, second: IPromise, resultSelector: (v1: T, v2: T2) => TResult): Observable; combineLatest(first: IPromise, second: IPromise, resultSelector: (v1: T, v2: T2) => TResult): Observable; combineLatest(first: Observable, second: Observable, third: Observable, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; combineLatest(first: Observable, second: Observable, third: IPromise, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; combineLatest(first: Observable, second: IPromise, third: Observable, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; combineLatest(first: Observable, second: IPromise, third: IPromise, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; combineLatest(first: IPromise, second: Observable, third: Observable, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; combineLatest(first: IPromise, second: Observable, third: IPromise, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; combineLatest(first: IPromise, second: IPromise, third: Observable, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; combineLatest(first: IPromise, second: IPromise, third: IPromise, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; combineLatest(first: Observable, second: Observable, third: Observable, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; combineLatest(first: Observable, second: Observable, third: Observable, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; combineLatest(first: Observable, second: Observable, third: IPromise, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; combineLatest(first: Observable, second: Observable, third: IPromise, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; combineLatest(first: Observable, second: IPromise, third: Observable, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; combineLatest(first: Observable, second: IPromise, third: Observable, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; combineLatest(first: Observable, second: IPromise, third: IPromise, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; combineLatest(first: Observable, second: IPromise, third: IPromise, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; combineLatest(first: IPromise, second: Observable, third: Observable, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; combineLatest(first: IPromise, second: Observable, third: Observable, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; combineLatest(first: IPromise, second: Observable, third: IPromise, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; combineLatest(first: IPromise, second: Observable, third: IPromise, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; combineLatest(first: IPromise, second: IPromise, third: Observable, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; combineLatest(first: IPromise, second: IPromise, third: Observable, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; combineLatest(first: IPromise, second: IPromise, third: IPromise, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; combineLatest(first: IPromise, second: IPromise, third: IPromise, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; combineLatest(first: Observable, second: Observable, third: Observable, fourth: Observable, fifth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4, v5: T5) => TResult): Observable; combineLatest(souces: Observable[], resultSelector: (...otherValues: TOther[]) => TResult): Observable; combineLatest(souces: IPromise[], resultSelector: (...otherValues: TOther[]) => TResult): Observable; withLatestFrom(first: Observable, second: Observable, resultSelector: (v1: T, v2: T2) => TResult): Observable; withLatestFrom(first: IPromise, second: Observable, resultSelector: (v1: T, v2: T2) => TResult): Observable; withLatestFrom(first: Observable, second: IPromise, resultSelector: (v1: T, v2: T2) => TResult): Observable; withLatestFrom(first: IPromise, second: IPromise, resultSelector: (v1: T, v2: T2) => TResult): Observable; withLatestFrom(first: Observable, second: Observable, third: Observable, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; withLatestFrom(first: Observable, second: Observable, third: IPromise, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; withLatestFrom(first: Observable, second: IPromise, third: Observable, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; withLatestFrom(first: Observable, second: IPromise, third: IPromise, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; withLatestFrom(first: IPromise, second: Observable, third: Observable, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; withLatestFrom(first: IPromise, second: Observable, third: IPromise, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; withLatestFrom(first: IPromise, second: IPromise, third: Observable, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; withLatestFrom(first: IPromise, second: IPromise, third: IPromise, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; withLatestFrom(first: Observable, second: Observable, third: Observable, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; withLatestFrom(first: Observable, second: Observable, third: Observable, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; withLatestFrom(first: Observable, second: Observable, third: IPromise, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; withLatestFrom(first: Observable, second: Observable, third: IPromise, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; withLatestFrom(first: Observable, second: IPromise, third: Observable, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; withLatestFrom(first: Observable, second: IPromise, third: Observable, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; withLatestFrom(first: Observable, second: IPromise, third: IPromise, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; withLatestFrom(first: Observable, second: IPromise, third: IPromise, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; withLatestFrom(first: IPromise, second: Observable, third: Observable, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; withLatestFrom(first: IPromise, second: Observable, third: Observable, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; withLatestFrom(first: IPromise, second: Observable, third: IPromise, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; withLatestFrom(first: IPromise, second: Observable, third: IPromise, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; withLatestFrom(first: IPromise, second: IPromise, third: Observable, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; withLatestFrom(first: IPromise, second: IPromise, third: Observable, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; withLatestFrom(first: IPromise, second: IPromise, third: IPromise, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; withLatestFrom(first: IPromise, second: IPromise, third: IPromise, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; withLatestFrom(first: Observable, second: Observable, third: Observable, fourth: Observable, fifth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4, v5: T5) => TResult): Observable; withLatestFrom(souces: Observable[], resultSelector: (...otherValues: TOther[]) => TResult): Observable; withLatestFrom(souces: IPromise[], resultSelector: (...otherValues: TOther[]) => TResult): Observable; concat(...sources: Observable[]): Observable; concat(...sources: IPromise[]): Observable; concat(sources: Observable[]): Observable; concat(sources: IPromise[]): Observable; merge(...sources: Observable[]): Observable; merge(...sources: IPromise[]): Observable; merge(sources: Observable[]): Observable; merge(sources: IPromise[]): Observable; merge(scheduler: IScheduler, ...sources: Observable[]): Observable; merge(scheduler: IScheduler, ...sources: IPromise[]): Observable; merge(scheduler: IScheduler, sources: Observable[]): Observable; merge(scheduler: IScheduler, sources: IPromise[]): Observable; pairs(obj: { [key: string]: T }, scheduler?: IScheduler): Observable<[string, T]>; zip(first: Observable, sources: Observable[], resultSelector: (item1: T1, ...right: T2[]) => TResult): Observable; zip(first: Observable, sources: IPromise[], resultSelector: (item1: T1, ...right: T2[]) => TResult): Observable; zip(source1: Observable, source2: Observable, resultSelector: (item1: T1, item2: T2) => TResult): Observable; zip(source1: Observable, source2: IPromise, resultSelector: (item1: T1, item2: T2) => TResult): Observable; zip(source1: Observable, source2: Observable, source3: Observable, resultSelector: (item1: T1, item2: T2, item3: T3) => TResult): Observable; zip(source1: Observable, source2: Observable, source3: IPromise, resultSelector: (item1: T1, item2: T2, item3: T3) => TResult): Observable; zip(source1: Observable, source2: IPromise, source3: Observable, resultSelector: (item1: T1, item2: T2, item3: T3) => TResult): Observable; zip(source1: Observable, source2: IPromise, source3: IPromise, resultSelector: (item1: T1, item2: T2, item3: T3) => TResult): Observable; zip(source1: Observable, source2: Observable, source3: Observable, source4: Observable, resultSelector: (item1: T1, item2: T2, item3: T3, item4: T4) => TResult): Observable; zip(source1: Observable, source2: Observable, source3: Observable, source4: IPromise, resultSelector: (item1: T1, item2: T2, item3: T3, item4: T4) => TResult): Observable; zip(source1: Observable, source2: Observable, source3: IPromise, source4: Observable, resultSelector: (item1: T1, item2: T2, item3: T3, item4: T4) => TResult): Observable; zip(source1: Observable, source2: Observable, source3: IPromise, source4: IPromise, resultSelector: (item1: T1, item2: T2, item3: T3, item4: T4) => TResult): Observable; zip(source1: Observable, source2: IPromise, source3: Observable, source4: Observable, resultSelector: (item1: T1, item2: T2, item3: T3, item4: T4) => TResult): Observable; zip(source1: Observable, source2: IPromise, source3: Observable, source4: IPromise, resultSelector: (item1: T1, item2: T2, item3: T3, item4: T4) => TResult): Observable; zip(source1: Observable, source2: IPromise, source3: IPromise, source4: Observable, resultSelector: (item1: T1, item2: T2, item3: T3, item4: T4) => TResult): Observable; zip(source1: Observable, source2: IPromise, source3: IPromise, source4: IPromise, resultSelector: (item1: T1, item2: T2, item3: T3, item4: T4) => TResult): Observable; zip(source1: Observable, source2: Observable, source3: Observable, source4: Observable, source5: Observable, resultSelector: (item1: T1, item2: T2, item3: T3, item4: T4, item5: T5) => TResult): Observable; zipArray(...sources: Observable[]): Observable; zipArray(sources: Observable[]): Observable; /** * Converts a Promise to an Observable sequence * @param promise An ES6 Compliant promise. * @returns An Observable sequence which wraps the existing promise success and failure. */ fromPromise(promise: IPromise): Observable; prototype: any; } export var Observable: ObservableStatic; interface ISubject extends Observable, Observer, IDisposable { hasObservers(): boolean; } export interface Subject extends ISubject { } interface SubjectStatic { new (): Subject; create(observer?: Observer, observable?: Observable): ISubject; } export var Subject: SubjectStatic; export interface AsyncSubject extends Subject { } interface AsyncSubjectStatic { new (): AsyncSubject; } export var AsyncSubject: AsyncSubjectStatic; }