source: trip-planner-front/node_modules/rxjs/internal/operators/timeInterval.d.ts

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.8 KB
RevLine 
[6a3a178]1import { SchedulerLike, OperatorFunction } from '../types';
2/**
3 *
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
9 * milliseconds.
10 *
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>
13 *
14 * ![](timeinterval.png)
15 *
16 * ## Examples
17 * Emit inteval between current value with the last value
18 *
19 * ```ts
20 * const seconds = interval(1000);
21 *
22 * seconds.pipe(timeInterval())
23 * .subscribe(
24 * value => console.log(value),
25 * err => console.log(err),
26 * );
27 *
28 * seconds.pipe(timeout(900))
29 * .subscribe(
30 * value => console.log(value),
31 * err => console.log(err),
32 * );
33 *
34 * // NOTE: The values will never be this precise,
35 * // intervals created with `interval` or `setInterval`
36 * // are non-deterministic.
37 *
38 * // {value: 0, interval: 1000}
39 * // {value: 1, interval: 1000}
40 * // {value: 2, interval: 1000}
41 * ```
42 *
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
46 */
47export declare function timeInterval<T>(scheduler?: SchedulerLike): OperatorFunction<T, TimeInterval<T>>;
48/**
49 * @deprecated exposed API, use as interface only.
50 */
51export declare class TimeInterval<T> {
52 value: T;
53 interval: number;
54 constructor(value: T, interval: number);
55}
Note: See TracBrowser for help on using the repository browser.