This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-10-17
Channels
- # beginners (45)
- # boot (33)
- # chestnut (9)
- # cider (2)
- # cljs-dev (24)
- # cljsrn (1)
- # clojure (114)
- # clojure-conj (3)
- # clojure-dev (3)
- # clojure-dusseldorf (3)
- # clojure-greece (5)
- # clojure-italy (22)
- # clojure-russia (10)
- # clojure-spec (12)
- # clojure-uk (19)
- # clojurescript (117)
- # core-async (16)
- # cursive (3)
- # data-science (1)
- # datomic (5)
- # docs (13)
- # emacs (1)
- # fulcro (13)
- # graphql (1)
- # hoplon (20)
- # immutant (3)
- # jobs (1)
- # juxt (12)
- # lein-figwheel (1)
- # luminus (4)
- # off-topic (12)
- # onyx (61)
- # portkey (1)
- # re-frame (21)
- # reagent (26)
- # ring-swagger (38)
- # rum (1)
- # shadow-cljs (222)
- # slack-help (4)
- # spacemacs (11)
- # specter (67)
- # uncomplicate (236)
I want to make a tip to flash, whenever a button is pressed, and fadeout
after that. If the button is pressed in succession, I want the tip to stop fadeout
and show from the start(and then fadeout). I write a reg-event-db
event handler in :dispatch
to make the tip to show, and another event handler in :dispatch-later
to make the tip to fadeout.
I want to add a :deregister-event-handler
to cancel the process of showing and fading out. and :dispatch
again.
Thanks @mikethompson
So I want to write this: {:dispatch-n (list [:deregister-event-handler [:show :fadeout]] [:show]) :dispatch-later [{:ms 200 :dispatch [:fadeout]}]}
re-frame
is used to drive deep learning development https://github.com/bpiel/guildsman
If I want to wrap every reframe event handler in a try-catch that reports, should I write my own , wrapper version of reg-event-fx?
(I'm on react native, and sometimes the only error reporting I have is "there was an error somewhere" - would love to narrow it down to a handler)
^ I did this
(defn reg-event-fx
([name f]
(reg-event-fx name [] f))
([name interceptors f]
(re-frame.core/reg-event-fx name interceptors (fn [& args] (try
(apply f args)
(catch :default e
(throw (js/Error. (str "Error handling " name "\n\n" (oget e "message"))))))))))
(defn reg-event-db
([name f]
(reg-event-db name [] f))
([name interceptors f]
(re-frame.core/reg-event-db name interceptors (fn [& args] (try
(apply f args)
(catch :default e
(throw (js/Error. (str "Error handling " name "\n\n" (oget e "message"))))))))))
is that a bad idea?
@danieleneal here maybe? https://github.com/Day8/re-frame/blob/master/docs/Debugging-Event-Handlers.md
Am I getting it right that routing in re-frame based app usually happens via setting some key in db and then matching components against it?
Seems like secretary wants you to do that
yes, pretty much everything view-related in re-frame happens that way @yury.solovyov
yes, @yury.solovyov , you may use re-frame-template +routes
which gives you secretary
convention
;; event
(re-frame/reg-event-db
:set-active-panel
(fn [db [_ active-panel]]
(assoc db :active-panel active-panel)))
;; view
(defn- panels [panel-name]
(case panel-name
:home-panel [home-panel]
:about-panel [about-panel]
[:div]))
(defn show-panel [panel-name]
[panels panel-name])
(defn main-panel []
(let [active-panel (re-frame/subscribe [:active-panel])]
(fn []
[show-panel @active-panel])))
I have an app already, just need to add secretary I guess
but thanks @lovuikeng
np @yury.solovyov re-frame-template
is like treasure hunt 🙂