rxjs 5 中的发布和多播运算符有什么区别? [英] What's the difference between publish and multicast operator in rxjs 5?
问题描述
我正在阅读 rxjs 手册,我对多播和发布操作符之间的区别有点困惑.它们看起来非常相似.
I'm reading the rxjs manual, I'm a little confused about what's the difference between multicast and publish operators. They seem very similar.
推荐答案
我在阅读 http://reactivex.io/rxjs/manual/overview.html.所以要说清楚,.publish()
只是 .multicast(new Rx.Subject())
(和 publishBehavior
,publishLast
和 publishReplay
类似,但分别实例化了 BehaviorSubject
、AsyncSubject
和 ReplaySubject
).
I had the same question when reading http://reactivex.io/rxjs/manual/overview.html. So to make it clear, .publish()
is just shorthand for .multicast(new Rx.Subject())
(and publishBehavior
, publishLast
, and publishReplay
are similar but instantiate BehaviorSubject
, AsyncSubject
and ReplaySubject
respectively).
这篇关于rxjs 5 中的发布和多播运算符有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!