1 import { Observable } from '../Observable';
2 import { SchedulerLike } from '../types';
4 * Creates an Observable that starts emitting after an `dueTime` and
5 * emits ever increasing numbers after each `period` of time thereafter.
7 * <span class="informal">Its like {@link index/interval}, but you can specify when
8 * should the emissions start.</span>
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
22 * ### Emits ascending numbers, one every second (1000ms), starting after 3 seconds
24 * import { timer } from 'rxjs';
26 * const numbers = timer(3000, 1000);
27 * numbers.subscribe(x => console.log(x));
30 * ### Emits one number after five seconds
32 * import { timer } from 'rxjs';
34 * const numbers = timer(5000);
35 * numbers.subscribe(x => console.log(x));
37 * @see {@link index/interval}
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
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
53 export declare function timer(dueTime?: number | Date, periodOrScheduler?: number | SchedulerLike, scheduler?: SchedulerLike): Observable<number>;