Fork me on GitHub
#cljfx
<
2020-11-21
>
jpmonettas14:11:24

hellow everybody! what is a good way of accessing the event-handler fn inside a component? I know we can dispatch events with a event map, but I need to do it with a function like

:on-selection-changed (fn [ev]
                        (when (.isSelected (.getTarget ev))
                          (event-handler {:event/type ...})))
Is there a way of accessing the dispatch fn like we access the context inside components, without the need of a global reference?

vlaaad15:11:39

I'm afraid it's impossible :/

jpmonettas15:11:46

what do you think is the best solution in this case, just dispatch with a event map and apply that .isSelected logic on the event-handler or create a global reference with event-handler?

vlaaad15:11:49

I would just use event map

vlaaad15:11:25

Event map handler receives an event too, so this logic can be moved there

jpmonettas15:11:47

nice, will do that, thanks again!!!