Learn RxJS
Search
⌃K

repeat

signature: repeat(count: number): Observable

Repeats an observable on completion.

💡 Like retry but for non error cases!
​​
Ultimate RxJS
​
​

Examples

Example 1: Repeat 3 times
// 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
Last modified 3yr ago