This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-12-04
Channels
- # adventofcode (171)
- # beginners (160)
- # boot (13)
- # chestnut (2)
- # cider (6)
- # cljs-dev (15)
- # cljsjs (35)
- # cljsrn (1)
- # clojure (139)
- # clojure-argentina (3)
- # clojure-brasil (1)
- # clojure-greece (31)
- # clojure-italy (5)
- # clojure-russia (5)
- # clojure-spec (18)
- # clojure-uk (11)
- # clojurescript (42)
- # clojurex (6)
- # core-async (12)
- # cursive (14)
- # dirac (13)
- # emacs (13)
- # events (1)
- # fulcro (46)
- # graphql (7)
- # leiningen (10)
- # lumo (3)
- # mount (31)
- # off-topic (20)
- # onyx (30)
- # perun (4)
- # planck (47)
- # re-frame (28)
- # reagent (14)
- # ring (5)
- # shadow-cljs (3)
- # spacemacs (7)
- # specter (13)
- # timbre (3)
- # unrepl (65)
- # yada (8)
Guys how so mount doesn’t support async start/stop. For example, if I need to load config asynchronously. How is that usually handled?
I need to load some configuration from locally running blockchain (understand server). Cannot be done in sync way. Other components might need this configuration data in their :start
function
not sure what you mean. that request to locally running server to fetch config. It’s separate app from the cljs app
and you need to load configuration from the server whenever someone visits a page / or the cljs app starts?
no, it’s different. Have just one, it’s cljs nodejs app, the other one is blockchain, it’s 3rd party software beyond my control
ok, and you need to load config from a 3rd party app (i.e. a server) on cljs nodejs app
's start?
mount will respect the order of states that need to be started, which means components which need this configuration will wait until a component that loads it from the server is started. i.e. if you have something like:
(defstate config :start (load-it-from-server ""))
and other components depend on this config
they will waitthe thing is that library to interact with blockchain server doesn’t support synchronous requests. Must pass callback
right, so you can put it in a channel once the response is received. pseudo code:
(let [c (async/chan)]
(http/get url #(>!! c %))
(<!! c))
ah.. cljs
that's right, single event loop. then you would provide a callback that does (mount/start)
. once the config is loaded, mount will start all the components
I see, that’s what I started thinking, okay I’ll figure out something, thank you very much for your time 😉
yeah, I have that in mind, thanks but would be nice if I could just pass channel or something to defstate and it would wait with execution until results come and then pass it