(defn view
[]
(ui/on
:mouse-down (fn [e] (do (println "mouse down") [[::hello-world]]))
::hello-world (fn [] (do (println "hello world") [[::what]]))
(ui/button "hi")))
(ui/mouse-down (view) [0 0])
;; prints "mouse down" and returns `[[::hello-world]]`
(defn view
[]
(ui/on-bubble
(fn [events]
(map #(case (first %)
::hello-world (do (println "hello world") [[::what]])
%)
events))
(ui/on
:mouse-down (fn [e] (do (println "mouse down") [[::hello-world]]))
(ui/button "hi"))))
(ui/mouse-down (view) [0 0])
;; prints "hello world\nmouse down" and returns `([[:skipper.edit/what]])`
Why doesn't the first example work with ui/on? I expect it to behave the same as the second example with ui/on-bubble.
Thanks!The order is the same as wrapping, ie. it works if ::hello-world is before :mouse-down
(defn view
[]
(ui/on
::hello-world (fn [] (do (println "hello world") [[::what]]))
:mouse-down (fn [e] (do (println "mouse down") [[::hello-world]]))
(ui/button "hi")))
(ui/mouse-down (view) [0 0])
;; ([::what])I see.
That seems tricky. I don't know what I want to see though. I hope I'll form opinions as I go.
Thanks.