skipUntil

签名: skipUntil(the: Observable): Observable

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

示例

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

( jsBin |
jsFiddle )

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

其他资源


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