Add the ability to forward messages to multiple receivers
#644
chriskilding
started this conversation in
Ideas
Replies: 1 comment
-
|
You could pass down a (Unfortunately, there does not seem to be any examples on how to use a reducer. I have a working example program which I could prepare a PR for.) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Imagine you have the following Components, as part of a wider application:
App: your top-level component with the app windowDocument: a headless component, just responsible for saving thingsContent: a content sub-viewSidebar: a sidebar sub-viewAt the moment, if
ContentorSidebarraise any events that you'd like to save to theDocument, you'd have to relay all those events through theApp's events. In other words you have to createAppInputevents that mirror all of theContentandSidebarevents.As a result, the
App's events balloon to encompass everything you might want to send to (or between) the child views, which is not ideal.Is there a better way to accomplish this?
What if the
MessageBroker(or something like it, such as aRouter) were adapted to provide the ability to forward events to multiple receivers. Something like this...Side note: I don't exactly know where the
broker(orrouter) object should be hosted, so initially I've made it one of thefn initarguments / context. This also means its parent Component will have a persistent reference to it, which ensures thebrokerobject will stick around for the lifetime of the Component (which is what we want).Beta Was this translation helpful? Give feedback.
All reactions