Rx.Subject.create(observer, observable) 混乱

Rx.Subject.create(observer, observable) confusion

API documentation 它说

Arguments

  1. observer (Observer): The observer used to send messages to the subject.
  2. observable (Observable): The observable used to subscribe to messages sent from the subject.

但是,观察者应该是从主题发出的 receiving/handling 消息,而 Observable 是主题将订阅的内容,这不是倒退的概念吗? API 文档和 getting started with subjects doc 似乎不一致。

您的问题已在此处得到解答:

Subject.create 是一个静态方法,它只是将 Observable 与观察者连接起来。不涉及 Subject 的实例。

您所描述的看起来更像是多播,因此也许可以看看 multicast() 运算符或其派生词。

另见: