rxjs 5 中的发布和多播运算符有什么区别? [英] What's the difference between publish and multicast operator in rxjs 5?

查看:64
本文介绍了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())(和 publishBehaviorpublishLastpublishReplay 类似,但分别实例化了 BehaviorSubjectAsyncSubjectReplaySubject).

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆