Scheduler

Other topics

Using a TestScheduler to advance time manually

Most Rx operators take an optional scheduler on which to schedule their future iterations. If not supplied they will use their default configured scheduler. Supplying a scheduler can be useful for testing purposes in which we like to talk about virtual time instead of real time for speed of test execution.

const scheduler = new Rx.TestScheduler();
scheduler.stop();
Rx.Observable.interval(100, scheduler)
  .do(i => console.log(i))
  .subscribe();
scheduler.advanceBy(10 * 100);

Contributors

Topic Id: 7991

Example Ids: 25835

This site is not affiliated with any of the contributors.