Fork me on GitHub
#keechma
<
2017-08-14
>
urbank11:08:42

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

mihaelkonjevic11:08:01

you mean multiple controllers?

urbank11:08:19

Oh, yeah, that

mihaelkonjevic11:08:29

not out of the box

mihaelkonjevic11:08:50

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

mihaelkonjevic11:08:37

and it was a very extreme corner case

mihaelkonjevic11:08:00

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

mihaelkonjevic11:08:21

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

mihaelkonjevic11:08:01

here’s an example of the second case:

urbank11:08:44

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.

mihaelkonjevic11:08:17

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

mihaelkonjevic11:08:40

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

mihaelkonjevic11:08:55

if the controller could add a topic when sending a command

mihaelkonjevic11:08:05

that would couple that component and the controller

mihaelkonjevic11:08:25

and as I said, it is a very rare occasion

mihaelkonjevic11:08:30

(at least in my case)

mihaelkonjevic11:08:47

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

mihaelkonjevic11:08:59

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

urbank11:08:53

Yeah, a relay controller actually sounds quite elegant.

urbank12:08:56

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