import { PartialObserver } from './Observer'; import { Operator } from './Operator'; import { Subscriber } from './Subscriber'; import { Subscription, AnonymousSubscription, TeardownLogic } from './Subscription'; import { IfObservable } from './observable/IfObservable'; import { ErrorObservable } from './observable/ErrorObservable'; import { OperatorFunction } from './interfaces'; export interface Subscribable { subscribe(observerOrNext?: PartialObserver | ((value: T) => void), error?: (error: any) => void, complete?: () => void): AnonymousSubscription; } export declare type SubscribableOrPromise = Subscribable | PromiseLike; export declare type ObservableInput = SubscribableOrPromise | ArrayLike; /** * A representation of any set of values over any amount of time. This is the most basic building block * of RxJS. * * @class Observable */ export declare class Observable implements Subscribable { _isScalar: boolean; /** @deprecated internal use only */ source: Observable; protected operator: Operator; /** * @constructor * @param {Function} subscribe the function that is called when the Observable is * initially subscribed to. This function is given a Subscriber, to which new values * can be `next`ed, or an `error` method can be called to raise an error, or * `complete` can be called to notify of a successful completion. */ constructor(subscribe?: (this: Observable, subscriber: Subscriber) => TeardownLogic); /** * Creates a new cold Observable by calling the Observable constructor * @static true * @owner Observable * @method create * @param {Function} subscribe? the subscriber function to be passed to the Observable constructor * @return {Observable} a new cold observable */ static create: Function; /** * Creates a new Observable, with this Observable as the source, and the passed * operator defined as the new observable's operator. * @method lift * @param {Operator} operator the operator defining the operation to take on the observable * @return {Observable} a new observable with the Operator applied */ lift(operator: Operator): Observable; subscribe(observer?: PartialObserver): Subscription; subscribe(next?: (value: T) => void, error?: (error: any) => void, complete?: () => void): Subscription; protected _trySubscribe(sink: Subscriber): TeardownLogic; /** * @method forEach * @param {Function} next a handler for each value emitted by the observable * @param {PromiseConstructor} [PromiseCtor] a constructor function used to instantiate the Promise * @return {Promise} a promise that either resolves on observable completion or * rejects with the handled error */ forEach(next: (value: T) => void, PromiseCtor?: typeof Promise): Promise; /** @deprecated internal use only */ _subscribe(subscriber: Subscriber): TeardownLogic; static if: typeof IfObservable.create; static throw: typeof ErrorObservable.create; pipe(): Observable; pipe(op1: OperatorFunction): Observable; pipe(op1: OperatorFunction, op2: OperatorFunction): Observable; pipe(op1: OperatorFunction, op2: OperatorFunction, op3: OperatorFunction): Observable; pipe(op1: OperatorFunction, op2: OperatorFunction, op3: OperatorFunction, op4: OperatorFunction): Observable; pipe(op1: OperatorFunction, op2: OperatorFunction, op3: OperatorFunction, op4: OperatorFunction, op5: OperatorFunction): Observable; pipe(op1: OperatorFunction, op2: OperatorFunction, op3: OperatorFunction, op4: OperatorFunction, op5: OperatorFunction, op6: OperatorFunction): Observable; pipe(op1: OperatorFunction, op2: OperatorFunction, op3: OperatorFunction, op4: OperatorFunction, op5: OperatorFunction, op6: OperatorFunction, op7: OperatorFunction): Observable; pipe(op1: OperatorFunction, op2: OperatorFunction, op3: OperatorFunction, op4: OperatorFunction, op5: OperatorFunction, op6: OperatorFunction, op7: OperatorFunction, op8: OperatorFunction): Observable; pipe(op1: OperatorFunction, op2: OperatorFunction, op3: OperatorFunction, op4: OperatorFunction, op5: OperatorFunction, op6: OperatorFunction, op7: OperatorFunction, op8: OperatorFunction, op9: OperatorFunction): Observable; pipe(...operations: OperatorFunction[]): Observable; toPromise(this: Observable): Promise; toPromise(this: Observable, PromiseCtor: typeof Promise): Promise; toPromise(this: Observable, PromiseCtor: PromiseConstructorLike): Promise; }