123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536 |
- declare module Rx {
- export interface ObservableStatic {
-
- interval(period: number, scheduler?: IScheduler): Observable<number>;
- }
- export interface ObservableStatic {
-
- timer(dueTime: number, period: number, scheduler?: IScheduler): Observable<number>;
-
- timer(dueTime: number, scheduler?: IScheduler): Observable<number>;
- }
- export interface Observable<T> {
-
- delay(dueTime: Date, scheduler?: IScheduler): Observable<T>;
-
- delay(dueTime: number, scheduler?: IScheduler): Observable<T>;
-
- delay(delayDurationSelector: (item: T) => ObservableOrPromise<number>): Observable<T>;
-
- delay(subscriptionDelay: Observable<number>, delayDurationSelector: (item: T) => ObservableOrPromise<number>): Observable<T>;
- }
- export interface Observable<T> {
-
- debounce(dueTime: number, scheduler?: IScheduler): Observable<T>;
-
- debounce(debounceDurationSelector: (item: T) => ObservableOrPromise<any>): Observable<T>;
- }
- export interface Observable<T> {
-
- windowWithTime(timeSpan: number, timeShift: number, scheduler?: IScheduler): Observable<Observable<T>>;
-
- windowWithTime(timeSpan: number, scheduler?: IScheduler): Observable<Observable<T>>;
- }
- export interface Observable<T> {
-
- windowWithTimeOrCount(timeSpan: number, count: number, scheduler?: IScheduler): Observable<Observable<T>>;
- }
- export interface Observable<T> {
-
- bufferWithTime(timeSpan: number, timeShift: number, scheduler?: IScheduler): Observable<T[]>;
-
- bufferWithTime(timeSpan: number, scheduler?: IScheduler): Observable<T[]>;
- }
- export interface Observable<T> {
-
- bufferWithTimeOrCount(timeSpan: number, count: number, scheduler?: IScheduler): Observable<T[]>;
- }
- export interface TimeInterval<T> {
- value: T;
- interval: number;
- }
- export interface Observable<T> {
-
- timeInterval(scheduler?: IScheduler): Observable<TimeInterval<T>>;
- }
- export interface Timestamp<T> {
- value: T;
- timestamp: number;
- }
- export interface Observable<T> {
-
- timestamp(scheduler?: IScheduler): Observable<Timestamp<T>>;
- }
- export interface Observable<T> {
-
- sample(intervalOrSampler: number, scheduler?: IScheduler): Observable<T>;
-
- sample<TSample>(sampler: Observable<TSample>, scheduler?: IScheduler): Observable<T>;
-
- throttleLatest(interval: number, scheduler?: IScheduler): Observable<T>;
-
- throttleLatest<TSample>(sampler: Observable<TSample>, scheduler?: IScheduler): Observable<T>;
- }
- export interface Observable<T> {
-
- timeout(dueTime: Date, scheduler?: IScheduler): Observable<T>;
-
- timeout(dueTime: Date, other?: Observable<T>, scheduler?: IScheduler): Observable<T>;
-
- timeout(dueTime: number, scheduler?: IScheduler): Observable<T>;
-
- timeout(dueTime: number, other?: Observable<T>, scheduler?: IScheduler): Observable<T>;
-
- timeout<TTimeout>(timeoutdurationSelector: (item: T) => Observable<TTimeout>): Observable<T>;
- /**
- * Returns the source observable sequence, switching to the other observable sequence if a timeout is signaled.
- * @param {Function} timeoutDurationSelector Selector to retrieve an observable sequence that represents the timeout between the current element and the next element.
- * @param {Observable} other Sequence to return in case of a timeout. If not provided, this is set to Observable.throwException().
- * @returns {Observable} The source sequence switching to the other sequence in case of a timeout.
- */
- timeout<TTimeout>(timeoutdurationSelector: (item: T) => Observable<TTimeout>, other: Observable<T>): Observable<T>;
- /**
- * Returns the source observable sequence, switching to the other observable sequence if a timeout is signaled.
- * @param {Observable} [firstTimeout] Observable sequence that represents the timeout for the first element. If not provided, this defaults to Observable.never().
- * @param {Function} timeoutDurationSelector Selector to retrieve an observable sequence that represents the timeout between the current element and the next element.
- * @param {Observable} [other] Sequence to return in case of a timeout. If not provided, this is set to Observable.throwException().
- * @returns {Observable} The source sequence switching to the other sequence in case of a timeout.
- */
- timeout<TTimeout>(firstTimeout: Observable<TTimeout>, timeoutdurationSelector: (item: T) => Observable<TTimeout>, other?: Observable<T>): Observable<T>;
- }
- export interface ObservableStatic {
- /**
- * Generates an observable sequence by iterating a state from an initial state until the condition fails.
- *
- * @example
- * res = source.generateWithAbsoluteTime(0,
- * function (x) { return return true; },
- * function (x) { return x + 1; },
- * function (x) { return x; },
- * function (x) { return new Date(); }
- * });
- *
- * @param {Mixed} initialState Initial state.
- * @param {Function} condition Condition to terminate generation (upon returning false).
- * @param {Function} iterate Iteration step function.
- * @param {Function} resultSelector Selector function for results produced in the sequence.
- * @param {Function} timeSelector Time selector function to control the speed of values being produced each iteration, returning Date values.
- * @param {Scheduler} [scheduler] Scheduler on which to run the generator loop. If not specified, the timeout scheduler is used.
- * @returns {Observable} The generated sequence.
- */
- generateWithAbsoluteTime<TState, TResult>(
- initialState: TState,
- condition: (state: TState) => boolean,
- iterate: (state: TState) => TState,
- resultSelector: (state: TState) => TResult,
- timeSelector: (state: TState) => Date,
- scheduler?: IScheduler): Observable<TResult>;
- }
- export interface ObservableStatic {
- /**
- * Generates an observable sequence by iterating a state from an initial state until the condition fails.
- *
- * @example
- * res = source.generateWithRelativeTime(0,
- * function (x) { return return true; },
- * function (x) { return x + 1; },
- * function (x) { return x; },
- * function (x) { return 500; }
- * );
- *
- * @param {Mixed} initialState Initial state.
- * @param {Function} condition Condition to terminate generation (upon returning false).
- * @param {Function} iterate Iteration step function.
- * @param {Function} resultSelector Selector function for results produced in the sequence.
- * @param {Function} timeSelector Time selector function to control the speed of values being produced each iteration, returning integer values denoting milliseconds.
- * @param {Scheduler} [scheduler] Scheduler on which to run the generator loop. If not specified, the timeout scheduler is used.
- * @returns {Observable} The generated sequence.
- */
- generateWithRelativeTime<TState, TResult>(
- initialState: TState,
- condition: (state: TState) => boolean,
- iterate: (state: TState) => TState,
- resultSelector: (state: TState) => TResult,
- timeSelector: (state: TState) => number,
- scheduler?: IScheduler): Observable<TResult>;
- }
- export interface Observable<T> {
- /**
- * Time shifts the observable sequence by delaying the subscription with the specified relative time duration, using the specified scheduler to run timers.
- *
- * @example
- * 1 - res = source.delaySubscription(5000); // 5s
- * 2 - res = source.delaySubscription(5000, Rx.Scheduler.default); // 5 seconds
- *
- * @param {Number} dueTime Relative or absolute time shift of the subscription.
- * @param {Scheduler} [scheduler] Scheduler to run the subscription delay timer on. If not specified, the timeout scheduler is used.
- * @returns {Observable} Time-shifted sequence.
- */
- delaySubscription(dueTime: number, scheduler?: IScheduler): Observable<T>;
- }
- export interface Observable<T> {
- /**
- * Skips elements for the specified duration from the end of the observable source sequence, using the specified scheduler to run timers.
- *
- * 1 - res = source.skipLastWithTime(5000);
- * 2 - res = source.skipLastWithTime(5000, scheduler);
- *
- * @description
- * This operator accumulates a queue with a length enough to store elements received during the initial duration window.
- * As more elements are received, elements older than the specified duration are taken from the queue and produced on the
- * result sequence. This causes elements to be delayed with duration.
- * @param {Number} duration Duration for skipping elements from the end of the sequence.
- * @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout
- * @returns {Observable} An observable sequence with the elements skipped during the specified duration from the end of the source sequence.
- */
- skipLastWithTime(duration: number, scheduler?: IScheduler): Observable<T>;
- }
- export interface Observable<T> {
- /**
- * Returns elements within the specified duration from the end of the observable source sequence, using the specified schedulers to run timers and to drain the collected elements.
- * @description
- * This operator accumulates a queue with a length enough to store elements received during the initial duration window.
- * As more elements are received, elements older than the specified duration are taken from the queue and produced on the
- * result sequence. This causes elements to be delayed with duration.
- * @param {Number} duration Duration for taking elements from the end of the sequence.
- * @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
- * @returns {Observable} An observable sequence with the elements taken during the specified duration from the end of the source sequence.
- */
- takeLastWithTime(duration: number, timerScheduler?: IScheduler, loopScheduler?: IScheduler): Observable<T>;
- }
- export interface Observable<T> {
- /**
- * Returns an array with the elements within the specified duration from the end of the observable source sequence, using the specified scheduler to run timers.
- * @description
- * This operator accumulates a queue with a length enough to store elements received during the initial duration window.
- * As more elements are received, elements older than the specified duration are taken from the queue and produced on the
- * result sequence. This causes elements to be delayed with duration.
- * @param {Number} duration Duration for taking elements from the end of the sequence.
- * @param {Scheduler} scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
- * @returns {Observable} An observable sequence containing a single array with the elements taken during the specified duration from the end of the source sequence.
- */
- takeLastBufferWithTime(duration: number, scheduler?: IScheduler): Observable<T[]>;
- }
- export interface Observable<T> {
- /**
- * Takes elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers.
- *
- * @example
- * 1 - res = source.takeWithTime(5000, [optional scheduler]);
- * @description
- * This operator accumulates a queue with a length enough to store elements received during the initial duration window.
- * As more elements are received, elements older than the specified duration are taken from the queue and produced on the
- * result sequence. This causes elements to be delayed with duration.
- * @param {Number} duration Duration for taking elements from the start of the sequence.
- * @param {Scheduler} scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
- * @returns {Observable} An observable sequence with the elements taken during the specified duration from the start of the source sequence.
- */
- takeWithTime(duration: number, scheduler?: IScheduler): Observable<T>;
- }
- export interface Observable<T> {
- /**
- * Skips elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers.
- *
- * @example
- * 1 - res = source.skipWithTime(5000, [optional scheduler]);
- *
- * @description
- * Specifying a zero value for duration doesn't guarantee no elements will be dropped from the start of the source sequence.
- * This is a side-effect of the asynchrony introduced by the scheduler, where the action that causes callbacks from the source sequence to be forwarded
- * may not execute immediately, despite the zero due time.
- *
- * Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the duration.
- * @param {Number} duration Duration for skipping elements from the start of the sequence.
- * @param {Scheduler} scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
- * @returns {Observable} An observable sequence with the elements skipped during the specified duration from the start of the source sequence.
- */
- skipWithTime(duration: number, scheduler?: IScheduler): Observable<T>;
- }
- export interface Observable<T> {
- /**
- * Skips elements from the observable source sequence until the specified start time, using the specified scheduler to run timers.
- * Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the start time.
- *
- * @examples
- * 1 - res = source.skipUntilWithTime(new Date(), [scheduler]);
- * 2 - res = source.skipUntilWithTime(5000, [scheduler]);
- * @param {Date|Number} startTime Time to start taking elements from the source sequence. If this value is less than or equal to Date(), no elements will be skipped.
- * @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
- * @returns {Observable} An observable sequence with the elements skipped until the specified start time.
- */
- skipUntilWithTime(startTime: Date, scheduler?: IScheduler): Observable<T>;
- /**
- * Skips elements from the observable source sequence until the specified start time, using the specified scheduler to run timers.
- * Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the start time.
- *
- * @examples
- * 1 - res = source.skipUntilWithTime(new Date(), [scheduler]);
- * 2 - res = source.skipUntilWithTime(5000, [scheduler]);
- * @param {Date|Number} startTime Time to start taking elements from the source sequence. If this value is less than or equal to Date(), no elements will be skipped.
- * @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
- * @returns {Observable} An observable sequence with the elements skipped until the specified start time.
- */
- skipUntilWithTime(duration: number, scheduler?: IScheduler): Observable<T>;
- }
- export interface Observable<T> {
- /**
- * Takes elements for the specified duration until the specified end time, using the specified scheduler to run timers.
- * @param {Number | Date} endTime Time to stop taking elements from the source sequence. If this value is less than or equal to new Date(), the result stream will complete immediately.
- * @param {Scheduler} [scheduler] Scheduler to run the timer on.
- * @returns {Observable} An observable sequence with the elements taken until the specified end time.
- */
- takeUntilWithTime(endTime: Date, scheduler?: IScheduler): Observable<T>;
- /**
- * Takes elements for the specified duration until the specified end time, using the specified scheduler to run timers.
- * @param {Number | Date} endTime Time to stop taking elements from the source sequence. If this value is less than or equal to new Date(), the result stream will complete immediately.
- * @param {Scheduler} [scheduler] Scheduler to run the timer on.
- * @returns {Observable} An observable sequence with the elements taken until the specified end time.
- */
- takeUntilWithTime(duration: number, scheduler?: IScheduler): Observable<T>;
- }
- export interface Observable<T> {
- /**
- * Returns an Observable that emits only the first item emitted by the source Observable during sequential time windows of a specified duration.
- * @param {Number} windowDuration time to wait before emitting another item after emitting the last item
- * @param {Scheduler} [scheduler] the Scheduler to use internally to manage the timers that handle timeout for each item. If not provided, defaults to Scheduler.timeout.
- * @returns {Observable} An Observable that performs the throttle operation.
- */
- throttle(windowDuration: number, scheduler?: IScheduler): Observable<T>;
- }
- }
- declare module "rx.time" { export = Rx; }
|