You can set up an intermediate proxy mailbox that receives a list of address and message pairs, and then calls it a push of a button.
proxy : Mailbox (List (Address a, a)) proxy = mailbox []
You can then receive a broadcast signal that listens to the proxy mailbox and creates a bunch of Signal.send tasks to notify other addresses.
port broadcast : Signal (Task x (List ())) port broadcast = let tasks = List.map (uncurry Signal.send) in Signal.map (Task.sequence << tasks) proxy.signal
Now your onClick code will look something like this: where you pass the list of addresses and pairs of actions:
onClick proxy.address [(address, Action1), (address, Action2)]
Please note that in the above code, address refers to the address included in the browsing function, while proxy.address refers to the proxy mailbox we just installed.
This is a general purpose solution that will work for any number of signals.
source share