RxJS ignoreElements

2020-10-13 10:10 更新

忽略源 Observable 發(fā)出的所有項(xiàng)目,僅傳遞 調(diào)用 complete或的 error

ignoreElements( ): OperatorFunction<any, never>

參量

沒有參數(shù)。

returns

OperatorFunction<any, never>:僅調(diào)用的空 Observable completeerror,由源 Observable 調(diào)用。

描述

ignoreElements marble diagram

例子

忽略發(fā)射的值,對(duì)觀察值的完成做出反應(yīng)。

  1. import { of } from 'rxjs';
  2. import { ignoreElements } from 'rxjs/operators';
  3. of('you', 'talking', 'to', 'me').pipe(
  4. ignoreElements(),
  5. )
  6. .subscribe(
  7. word => console.log(word),
  8. err => console.log('error:', err),
  9. () => console.log('the end'),
  10. );
  11. // result:
  12. // 'the end'
以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)