Rxjava 简明教程
RxJava - Subjects
根据 Reactive ,一个 Subject 既可以充当 Observable,又可以充当 Observer。
As per the Reactive, a Subject can act as both Observable as well as Observer.
有四种类型的 Subject −
There are four types of Subjects −
Sr.No. |
Subject & Description |
1 |
Publish Subject Emits only those items which are emitted after time of subscription. |
2 |
*Replay Subject*Emits all the items emitted by source Observable regardless of when it has subscribed the Observable. |
3 |
Behavior Subject Upon subscription, emits the most recent item then continue to emit item emitted by the source Observable. |
4 |
Async Subject Emits the last item emitted by the source Observable after it’s completes emission. |