kefirjs / kefir

A Reactive Programming library for JavaScript
https://kefirjs.github.io/kefir/
MIT License
1.87k stars 97 forks source link

Equivalent to Subject #165

Closed 84564221 closed 8 years ago

84564221 commented 8 years ago

The Subject class inherits both Observable and Observer, in the sense that it is both an observer and an observable.

You can use a subject to subscribe all the observers, and then subscribe the subject to a backend data source. In this way, the subject can act as a proxy for a group of subscribers and a source.

rpominov commented 8 years ago

No, we had something similar to Subject. But it was considered a bad pattern and removed

antonioaguilar commented 6 years ago

Subjects in the RxJS world seem to be used for a range of use cases. I'm just curious as to how you would implement the use of Subjects in KefirJS - what pattern would you instead recommend to use to subscribe and publish to a Stream at the same time?

mAAdhaTTah commented 6 years ago

I use Kefir.stream to solve the problem 90% of the time. There are a very small set of a problems I require something like a Subject, mostly in framework code. Some more details about what you're trying to do specifically could help me assist here.

Edit: NVM, I see your other issue. Conversation continues in #276.

Macil commented 6 years ago

(Oh, the link in @rpominov's post was broken. I've edited his reply to fix it.)