📜  RxJava-主题

📅  最后修改于: 2020-11-12 05:30:25             🧑  作者: Mango


根据反应式,主体可以同时充当可观察者和观察者。

主题是一种在ReactiveX的某些实现中可用的桥梁或代理,它既充当观察者又充当Observable。因为它是观察者,所以可以订阅一个或多个Observable,并且因为它是Observable,所以可以通过释放观察到的项来传递它们,也可以发出新的项。

有四种类型的主题-

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.