Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

timer.d.ts 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import { Observable } from '../Observable';
  2. import { 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. * ```javascript
  24. * const numbers = timer(3000, 1000);
  25. * numbers.subscribe(x => console.log(x));
  26. * ```
  27. *
  28. * ### Emits one number after five seconds
  29. * ```javascript
  30. * const numbers = timer(5000);
  31. * numbers.subscribe(x => console.log(x));
  32. * ```
  33. * @see {@link index/interval}
  34. * @see {@link delay}
  35. *
  36. * @param {number|Date} [dueTime] The initial delay time specified as a Date object or as an integer denoting
  37. * milliseconds to wait before emitting the first value of 0`.
  38. * @param {number|SchedulerLike} [periodOrScheduler] The period of time between emissions of the
  39. * subsequent numbers.
  40. * @param {SchedulerLike} [scheduler=async] The {@link SchedulerLike} to use for scheduling
  41. * the emission of values, and providing a notion of "time".
  42. * @return {Observable} An Observable that emits a `0` after the
  43. * `dueTime` and ever increasing numbers after each `period` of time
  44. * thereafter.
  45. * @static true
  46. * @name timer
  47. * @owner Observable
  48. */
  49. export declare function timer(dueTime?: number | Date, periodOrScheduler?: number | SchedulerLike, scheduler?: SchedulerLike): Observable<number>;