1 import { SchedulerLike, OperatorFunction } from '../types';
4 * Emits an object containing the current value, and the time that has
5 * passed between emitting the current value and the previous value, which is
6 * calculated by using the provided `scheduler`'s `now()` method to retrieve
7 * the current time at each emission, then calculating the difference. The `scheduler`
8 * defaults to {@link asyncScheduler}, so by default, the `interval` will be in
11 * <span class="informal">Convert an Observable that emits items into one that
12 * emits indications of the amount of time elapsed between those emissions.</span>
14 * ![](timeinterval.png)
17 * Emit inteval between current value with the last value
20 * const seconds = interval(1000);
22 * seconds.pipe(timeInterval())
24 * value => console.log(value),
25 * err => console.log(err),
28 * seconds.pipe(timeout(900))
30 * value => console.log(value),
31 * err => console.log(err),
34 * // NOTE: The values will never be this precise,
35 * // intervals created with `interval` or `setInterval`
36 * // are non-deterministic.
38 * // {value: 0, interval: 1000}
39 * // {value: 1, interval: 1000}
40 * // {value: 2, interval: 1000}
43 * @param {SchedulerLike} [scheduler] Scheduler used to get the current time.
44 * @return {Observable<{ interval: number, value: T }>} Observable that emit infomation about value and interval
45 * @method timeInterval
47 export declare function timeInterval<T>(scheduler?: SchedulerLike): OperatorFunction<T, TimeInterval<T>>;
49 * @deprecated exposed API, use as interface only.
51 export declare class TimeInterval<T> {
54 constructor(value: T, interval: number);