ReactiveX / rxjs

A reactive programming library for JavaScript
https://rxjs.dev
Apache License 2.0
30.8k stars 3.01k forks source link

Best practices in dealing with EventEmitters that have many events #1240

Closed rgbkrk closed 8 years ago

rgbkrk commented 8 years ago

Is the right/standard thing to do to create many Observables?

How about for emitting - a series of Subscribers?

bholloway commented 8 years ago

Is the decision between a single event bus observable for all types vs an observable for each event type?

rgbkrk commented 8 years ago

Is the decision between a single event bus observable for all types vs an observable for each event type?

How would you structure the single event bus observable? Top level object with the event name?

bholloway commented 8 years ago

This may be more a question for stack overflow but I'll give my opinion. Keeping in mind I am not a contribute.

Having worked with signals for many years, and implementing reactivity with them, I can say you don't want a unified bus.

Object orientate each event type with its own observable. With an object for each event type you can see at a glance what code depends on what events.

But i guess this assumes dependency injection such as in angular (or robotlegs back in the day).

If you have crosscutting concerns you will want these observables to be part of a multiton, or otherwise factoried from some common point, so that you are aware of all instances. In short crosscutting is still not an argument for an event bus as such.

benlesh commented 8 years ago

Closing this issue as stale.

lock[bot] commented 6 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.