Learn RxJS
Search…
repeat

signature: repeat(count: number): Observable

Repeats an observable on completion.

πŸ’‘ Like retry but for non error cases!
​​
​
​

Examples

Example 1: Repeat 3 times
1
// RxJS v6+
2
import { repeat, delay } from 'rxjs/operators';
3
import { of } from 'rxjs';
4
​
5
const delayedThing = of('delayed value').pipe(delay(2000));
6
​
7
delayedThing
8
.pipe(repeat(3))
9
// delayed value...delayed value...delayed value
10
.subscribe(console.log);
Copied!

Additional Resources

    ​repeat πŸ“° - Official docs
Last modified 1yr ago