Last updated 5 years ago
Was this helpful?
repeat(count: number): Observable
retry와 같지만, 에러가 없는 경우에만 반복합니다!
retry
예시 1: 3번 반복합니다
( 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);
Click Ninja Game
Lockscreen
Space Invaders Game
Swipe To Refresh
repeat - 공식 문서
Source Code: https://github.com/ReactiveX/rxjs/blob/master/src/internal/operators/repeat.ts