repeat

October 16, 2025 ยท View on GitHub

signature: repeat(count: number): Observable

Repeats an observable on completion.


๐Ÿ’ก Like retry but for non error cases!


Examples

Example 1: Repeat 3 times

( StackBlitz )

// RxJS v6+
import { repeat, delay } from 'rxjs/operators';
import { of } from 'rxjs';

const delayedThing = of('delayed value').pipe(delay(2000));

delayedThing
  .pipe(repeat(3))
  // delayed value...delayed value...delayed value
  .subscribe(console.log);

Additional Resources

  • repeat ๐Ÿ“ฐ - Official docs

๐Ÿ“ Source Code: https://github.com/ReactiveX/rxjs/blob/master/packages/rxjs/src/internal/operators/repeat.ts