RxJS ignoreElements

2020-10-13 10:10 更新

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

ignoreElements( ): OperatorFunction<any, never>

參量

沒有參數(shù)。

returns

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

描述

ignoreElements marble diagram

例子

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

import { of } from 'rxjs';
import { ignoreElements } from 'rxjs/operators';


of('you', 'talking', 'to', 'me').pipe(
  ignoreElements(),
)
.subscribe(
  word => console.log(word),
  err => console.log('error:', err),
  () => console.log('the end'),
);
// result:
// 'the end'
以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號