skipWhile

signature: skipWhile(predicate: Function): Observable

Skip emitted values from source until provided expression is false.

Examples

Example 1: Skip while values below threshold

( jsBin | jsFiddle )

import { interval } from 'rxjs/observable/interval';
import { skipWhile } from 'rxjs/operators';

//emit every 1s
const source = interval(1000);
//skip emitted values from source while value is less than 5
const example = source.pipe(skipWhile(val => val < 5));
//output: 5...6...7...8........
const subscribe = example.subscribe(val => console.log(val));

Additional Resources


:file_folder: Source Code: https://github.com/ReactiveX/rxjs/blob/master/src/internal/patching/operator/skipWhile.ts

results matching ""

    No results matching ""