keechma 2017-08-14

@mihaelkonjevic Is it possible for a component to dispatch actions to multiple controllers?

you mean multiple controllers?

Oh, yeah, that

not out of the box

there was only one occasion where I had a need for that

and it was a very extreme corner case

you can either relay it from a controller (with send-command)

or you can hook into the channel that’s used for commands and do it from there

here’s an example of the second case:

Ok cool. Thanks for the example! I don't actually need it right now, it just came to mind when I saw that :topic was assoc-ed directly on the component as a keyword.

yes, and I’ve spent a lot of time thinking about it (especially after writing the example I just posted)

the reason why a component can talk only to one controller is because you can swap the topic from the outside

if the controller could add a topic when sending a command

that would couple that component and the controller

and as I said, it is a very rare occasion

(at least in my case)

if I had a system where that was needed in more than one place

I’d probably write a “relay” controller which would take care of that

Yeah, a relay controller actually sounds quite elegant.

So a controller which receives component commands and sends them out to the relevant controllers?