This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-03-14
Channels
- # announcements (3)
- # babashka-sci-dev (22)
- # beginners (6)
- # calva (36)
- # cljsrn (1)
- # clojure (59)
- # clojure-europe (31)
- # clojure-france (3)
- # clojure-gamedev (1)
- # clojure-nl (1)
- # clojure-norway (1)
- # clojure-uk (4)
- # clojurescript (6)
- # conjure (1)
- # cursive (11)
- # data-oriented-programming (1)
- # datahike (2)
- # docker (8)
- # duct (4)
- # emacs (1)
- # figwheel-main (5)
- # kaocha (1)
- # leiningen (8)
- # lsp (64)
- # malli (10)
- # membrane (5)
- # nrepl (11)
- # off-topic (5)
- # portal (6)
- # quil (9)
- # reagent (62)
- # reitit (15)
- # releases (3)
- # ring-swagger (2)
- # shadow-cljs (36)
- # specter (2)
- # tools-deps (21)
(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!👀 1
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])