IntervalObservable.d.ts 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import { Subscriber } from '../Subscriber';
  2. import { IScheduler } from '../Scheduler';
  3. import { Observable } from '../Observable';
  4. /**
  5. * We need this JSDoc comment for affecting ESDoc.
  6. * @extends {Ignored}
  7. * @hide true
  8. */
  9. export declare class IntervalObservable extends Observable<number> {
  10. private period;
  11. private scheduler;
  12. /**
  13. * Creates an Observable that emits sequential numbers every specified
  14. * interval of time, on a specified IScheduler.
  15. *
  16. * <span class="informal">Emits incremental numbers periodically in time.
  17. * </span>
  18. *
  19. * <img src="./img/interval.png" width="100%">
  20. *
  21. * `interval` returns an Observable that emits an infinite sequence of
  22. * ascending integers, with a constant interval of time of your choosing
  23. * between those emissions. The first emission is not sent immediately, but
  24. * only after the first period has passed. By default, this operator uses the
  25. * `async` IScheduler to provide a notion of time, but you may pass any
  26. * IScheduler to it.
  27. *
  28. * @example <caption>Emits ascending numbers, one every second (1000ms)</caption>
  29. * var numbers = Rx.Observable.interval(1000);
  30. * numbers.subscribe(x => console.log(x));
  31. *
  32. * @see {@link timer}
  33. * @see {@link delay}
  34. *
  35. * @param {number} [period=0] The interval size in milliseconds (by default)
  36. * or the time unit determined by the scheduler's clock.
  37. * @param {Scheduler} [scheduler=async] The IScheduler to use for scheduling
  38. * the emission of values, and providing a notion of "time".
  39. * @return {Observable} An Observable that emits a sequential number each time
  40. * interval.
  41. * @static true
  42. * @name interval
  43. * @owner Observable
  44. */
  45. static create(period?: number, scheduler?: IScheduler): Observable<number>;
  46. static dispatch(state: any): void;
  47. constructor(period?: number, scheduler?: IScheduler);
  48. /** @deprecated internal use only */ _subscribe(subscriber: Subscriber<number>): void;
  49. }