This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-11-24
Channels
- # arachne (1)
- # bangalore-clj (11)
- # beginners (177)
- # boot (63)
- # business (1)
- # cljsjs (21)
- # cljsrn (3)
- # clojars (4)
- # clojure (116)
- # clojure-art (4)
- # clojure-belgium (3)
- # clojure-india (1)
- # clojure-italy (6)
- # clojure-russia (14)
- # clojure-spec (8)
- # clojure-uk (67)
- # clojurescript (51)
- # community-development (5)
- # cursive (13)
- # datascript (14)
- # datomic (29)
- # devcards (3)
- # emacs (3)
- # events (3)
- # funcool (4)
- # hoplon (29)
- # mount (6)
- # om (34)
- # om-next (5)
- # onyx (16)
- # perun (8)
- # planck (22)
- # re-frame (13)
- # reagent (5)
- # ring-swagger (21)
- # rum (3)
- # spacemacs (3)
- # specter (1)
- # untangled (39)
@knaman you have to create a subscription, which filters the alerts and then register to that one.
@danielgrosse filter by what? alerts is simply a list of alert items
I try to get my head around the reg-event-fx function. So the cofx argument is the db, which is returned by the dispatch function?
(reg-sub
:newest-alerts
:<- [:alerts]
(fn [alerts _]
(filter #(> date %) alerts))
You subscripe to this subscription in a new one, and then modify the data to the needed form. Then you can subscripe to it in your edit function
@danielgrosse ok, but the edit is like a modal box, so that function will be called even when a new alert is added
So the edit box opens if a alert occurs?
@danielgrosse no, there is an edit button which opens the relevant edit box
@danielgrosse ok, seems like if dont access @alerts in side fn and instead use in let , it doesnt gets called
What’s a good strategy for writing asynchronous subscription handlers? i.e, their computation function has an async call for some reason or another (io and such)
@tomerweller set a complete
flag in the app db when async fn has completed?
@michael.heuberger you mean dispatching an event and subscribing for the relevant path in the db?