RxJS AsyncSubject

2020-10-09 17:50 更新

Subject 的變體,僅在完成時(shí)才發(fā)出值。完成后,它將向所有觀察者發(fā)出其最新價(jià)值。

  1. class AsyncSubject<T> extends Subject {
  2. _subscribe(subscriber: Subscriber<any>): Subscription
  3. next(value: T): void
  4. error(error: any): void
  5. complete(): void
  6. // inherited from index/Subject
  7. static create: Function
  8. constructor()
  9. observers: Observer<T>[]
  10. closed: false
  11. isStopped: false
  12. hasError: false
  13. thrownError: any
  14. lift<R>(operator: Operator<T, R>): Observable<R>
  15. next(value?: T)
  16. error(err: any)
  17. complete()
  18. unsubscribe()
  19. _trySubscribe(subscriber: Subscriber<T>): TeardownLogic
  20. _subscribe(subscriber: Subscriber<T>): Subscription
  21. asObservable(): Observable<T>
  22. // inherited from index/Observable
  23. static create: Function
  24. static if: typeof iif
  25. static throw: typeof throwError
  26. constructor(subscribe?: (this: Observable<T>, subscriber: Subscriber<T>) => TeardownLogic)
  27. _isScalar: boolean
  28. source: Observable<any>
  29. operator: Operator<any, T>
  30. lift<R>(operator: Operator<T, R>): Observable<R>
  31. subscribe(observerOrNext?: NextObserver<T> | ErrorObserver<T> | CompletionObserver<T> | ((value: T) => void), error?: (error: any) => void, complete?: () => void): Subscription
  32. _trySubscribe(sink: Subscriber<T>): TeardownLogic
  33. forEach(next: (value: T) => void, promiseCtor?: PromiseConstructorLike): Promise<void>
  34. pipe(...operations: OperatorFunction<any, any>[]): Observable<any>
  35. toPromise(promiseCtor?: PromiseConstructorLike): Promise<T>
  36. }

方法

訂閱() _subscribe(subscriber: Subscriber<any>): Subscription

參量: 類(lèi)型:
Type Subscriber

Returns Subscription

下一個(gè)() next(value: T): void

參量: 類(lèi)型:
T

Returns void

錯(cuò)誤()

參量: 類(lèi)型:
error any

Returnsvoid

完成()
complete(): void參量沒(méi)有參數(shù)。Returnsvoid
以上內(nèi)容是否對(duì)您有幫助:
在線(xiàn)筆記
App下載
App下載

掃描二維碼

下載編程獅App

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

編程獅公眾號(hào)