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.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. * ```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. */
  53. export declare function timer(dueTime?: number | Date, periodOrScheduler?: number | SchedulerLike, scheduler?: SchedulerLike): Observable<number>;