cdb3af9ccd105f164b7a52ac06181eb6a5789d5700e425ebb963d31cfd19e6611d508ca2b0eb87f32e1d9a4ccf5b4fdec3e60954e845e132d226859fc45774 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import { Observable } from '../Observable';
  2. import { SchedulerLike } from '../types';
  3. /**
  4. * Creates an Observable that emits sequential numbers every specified
  5. * interval of time, on a specified {@link SchedulerLike}.
  6. *
  7. * <span class="informal">Emits incremental numbers periodically in time.</span>
  8. *
  9. * ![](interval.png)
  10. *
  11. * `interval` returns an Observable that emits an infinite sequence of
  12. * ascending integers, with a constant interval of time of your choosing
  13. * between those emissions. The first emission is not sent immediately, but
  14. * only after the first period has passed. By default, this operator uses the
  15. * `async` {@link SchedulerLike} to provide a notion of time, but you may pass any
  16. * {@link SchedulerLike} to it.
  17. *
  18. * ## Example
  19. *
  20. * Emits ascending numbers, one every second (1000ms) up to the number 3
  21. *
  22. * ```ts
  23. * import { interval, take } from 'rxjs';
  24. *
  25. * const numbers = interval(1000);
  26. *
  27. * const takeFourNumbers = numbers.pipe(take(4));
  28. *
  29. * takeFourNumbers.subscribe(x => console.log('Next: ', x));
  30. *
  31. * // Logs:
  32. * // Next: 0
  33. * // Next: 1
  34. * // Next: 2
  35. * // Next: 3
  36. * ```
  37. *
  38. * @see {@link timer}
  39. * @see {@link delay}
  40. *
  41. * @param period The interval size in milliseconds (by default) or the time unit determined
  42. * by the scheduler's clock.
  43. * @param scheduler The {@link SchedulerLike} to use for scheduling the emission of values,
  44. * and providing a notion of "time".
  45. * @return An Observable that emits a sequential number each time interval.
  46. */
  47. export declare function interval(period?: number, scheduler?: SchedulerLike): Observable<number>;
  48. //# sourceMappingURL=interval.d.ts.map