How do I make an Observable Interval start immediately without a delay?

Before RxJs 6:

Observable.timer(0, 1000) will start immediately.

RxJs 6+

import {timer} from 'rxjs/observable/timer';
timer(0, 1000).subscribe(() => { ... });

RxJs 6. Note: With this solution, 0 value will be emitted twice (one time immediately by startWith, and one time by interval stream after the first "tick", so if you care about the value emitted, you could consider startWith(-1) instead of startWith(0)

interval(100).pipe(startWith(0)).subscribe(() => { //your code }); 

or with timer:

import {timer} from 'rxjs/observable/timer';
timer(0, 100).subscribe(() => {

    });

Tags:

Reactivex

Rxjs