source: trip-planner-front/node_modules/rxjs/internal/observable/timer.d.ts@ 8d391a1

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

initial commit

  • Property mode set to 100644
File size: 2.2 KB
Line 
1import { Observable } from '../Observable';
2import { SchedulerLike } from '../types';
3/**
4 * Creates an Observable that starts emitting after an `dueTime` and
5 * emits ever increasing numbers after each `period` of time thereafter.
6 *
7 * <span class="informal">Its like {@link index/interval}, but you can specify when
8 * should the emissions start.</span>
9 *
10 * ![](timer.png)
11 *
12 * `timer` returns an Observable that emits an infinite sequence of ascending
13 * integers, with a constant interval of time, `period` of your choosing
14 * between those emissions. The first emission happens after the specified
15 * `dueTime`. The initial delay may be a `Date`. By default, this
16 * operator uses the {@link asyncScheduler} {@link SchedulerLike} to provide a notion of time, but you
17 * may pass any {@link SchedulerLike} to it. If `period` is not specified, the output
18 * Observable emits only one value, `0`. Otherwise, it emits an infinite
19 * sequence.
20 *
21 * ## Examples
22 * ### Emits ascending numbers, one every second (1000ms), starting after 3 seconds
23 * ```ts
24 * import { timer } from 'rxjs';
25 *
26 * const numbers = timer(3000, 1000);
27 * numbers.subscribe(x => console.log(x));
28 * ```
29 *
30 * ### Emits one number after five seconds
31 * ```ts
32 * import { timer } from 'rxjs';
33 *
34 * const numbers = timer(5000);
35 * numbers.subscribe(x => console.log(x));
36 * ```
37 * @see {@link index/interval}
38 * @see {@link delay}
39 *
40 * @param {number|Date} [dueTime] The initial delay time specified as a Date object or as an integer denoting
41 * milliseconds to wait before emitting the first value of 0`.
42 * @param {number|SchedulerLike} [periodOrScheduler] The period of time between emissions of the
43 * subsequent numbers.
44 * @param {SchedulerLike} [scheduler=async] The {@link SchedulerLike} to use for scheduling
45 * the emission of values, and providing a notion of "time".
46 * @return {Observable} An Observable that emits a `0` after the
47 * `dueTime` and ever increasing numbers after each `period` of time
48 * thereafter.
49 * @static true
50 * @name timer
51 * @owner Observable
52 */
53export declare function timer(dueTime?: number | Date, periodOrScheduler?: number | SchedulerLike, scheduler?: SchedulerLike): Observable<number>;
Note: See TracBrowser for help on using the repository browser.