repeat

signature: repeat(count: number): Observable

Repeats the stream of items emitted by the source Observable at most count times.

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)
)
.subscribe(console.log)

Additional Resources


:file_folder: Source Code: https://github.com/ReactiveX/rxjs/blob/master/src/internal/operators/repeat.ts

results matching ""

    No results matching ""