This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-12-03
Channels
- # adventofcode (107)
- # announcements (1)
- # asami (14)
- # babashka (67)
- # beginners (89)
- # calva (34)
- # cider (17)
- # clj-kondo (5)
- # cljs-dev (2)
- # clojure (57)
- # clojure-europe (52)
- # clojure-india (1)
- # clojure-italy (1)
- # clojure-losangeles (2)
- # clojure-nl (6)
- # clojure-uk (39)
- # clojurescript (40)
- # community-development (3)
- # conjure (3)
- # cursive (17)
- # datomic (11)
- # docker (13)
- # events (3)
- # figwheel-main (3)
- # fulcro (12)
- # graalvm (7)
- # holy-lambda (7)
- # honeysql (9)
- # introduce-yourself (5)
- # malli (9)
- # minecraft (3)
- # missionary (21)
- # nextjournal (7)
- # off-topic (52)
- # pathom (3)
- # polylith (11)
- # portal (3)
- # re-frame (21)
- # reagent (34)
- # reclojure (7)
- # reitit (1)
- # reveal (11)
- # shadow-cljs (68)
- # tools-build (12)
- # tools-deps (5)
- # vim (4)
- # xtdb (9)
New to re-frame here. Why does the initialize
event have to be triggered for subscriptions to hold any data? Is there an reagent-atom created per each subscription or something along those lines?
Each re-frame subscription is Reagent's reaction. You have to dispatch an event that populates the app-db - otherwise, there will be no data in the app-db at all.
I'm not sure I understand. My app-db
is populated with data upon creation:
(defonce state-atom
(reagent/atom
{:time (js/Date.) ;; current time for display
:time-color "#f88"} ;; the colour in which the time should be shown
))
This is not app-db, this is your own ratom somewhere.
App-db is specifically re-frame.db/app-db
- it is the source of truth for all subscriptions, it is the place that events registered with reg-event-db
can change.
Right. You are of course right. I think I managed to confuse myself while reading the docs on state:https://day8.github.io/re-frame/application-state/
hello 👋, I'm looking to add a web worker to a re-frame app I'm working on.... any pointers on where to look/what to read?
Web workers aren't re-frame-specific at all, as well as interaction with them. From the re-frame perspective, it's no different from e.g. WebSockets or some async API - issuing a command/event is a side-effect that should go into an effect and reacting to incoming commands/events should be done via dispatching events in some loop/callback.
thanks... tried to user a web worker with shadow cljs and got an error 😞 https://clojurians.slack.com/archives/C6N245JGG/p1638540659068700