skipUntil

函数签名: skipUntil(the: Observable): Observable

跳过源 observable 发出的值,直到提供的 observable 发出值。

示例

示例 1: 跳过值直到另个 observable 发出值

( StackBlitz | jsBin | jsFiddle )

// RxJS v6+
import { interval, timer } from 'rxjs';
import { skipUntil } from 'rxjs/operators';

// 每1秒发出值
const source = interval(1000);
// 跳过源 observable 发出的值,直到内部 observable 发出值 (6s后)
const example = source.pipe(skipUntil(timer(6000)));
// 输出: 5...6...7...8........
const subscribe = example.subscribe(val => console.log(val));

其他资源


:file_folder: 源码: https://github.com/ReactiveX/rxjs/blob/master/src/internal/operators/skipUntil.ts

results matching ""

    No results matching ""