This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-03-12
Channels
- # announcements (65)
- # aws (1)
- # babashka (12)
- # beginners (111)
- # bristol-clojurians (1)
- # cider (32)
- # clj-kondo (55)
- # clojars (3)
- # clojure (71)
- # clojure-europe (17)
- # clojure-france (4)
- # clojure-italy (36)
- # clojure-losangeles (8)
- # clojure-nl (6)
- # clojure-uk (115)
- # clojurescript (2)
- # datomic (99)
- # fulcro (32)
- # graalvm (12)
- # graphql (20)
- # hoplon (203)
- # meander (56)
- # mount (3)
- # off-topic (17)
- # pathom (17)
- # reitit (22)
- # shadow-cljs (32)
- # spacemacs (9)
- # tools-deps (19)
- # vim (25)
- # vscode (3)
Hi. I'm new here — just joined a company that's using mount. :-)
What's the recommended way to check whether a state is running?
I think I want something like (defstate foo :start ... :stop (when <running> ...))
in order to checks which states are running:
(mount/running-states)
will return a set of states that are currently running
but to your specific example, foo
is available as a known reference "at a :stop
function", so depending on what type foo is, you can do something like that:
(defstate server :start (start-server)
:stop (when server (.stop server)))
I think I’m confused by the different values I’ve seen for the state. Sometimes I see an object that says “Pending”, sometimes an object that says “Not Started” (IIRC), and sometimes a value that I can apply my stop function to.
I really need to learn about the lifecycle of states, I guess.
For now, I’ve simply wrapped the start and stop forms in a (when <do-we-want-to-run-this-state> …
I think I’m confused by the different values I’ve seen for the state. Sometimes I see an object that says “Pending”, sometimes an object that says “Not Started” (IIRC), and sometimes a value that I can apply my stop function to.
I really need to learn about the lifecycle of states, I guess.
For now, I’ve simply wrapped the start and stop forms in a (when <do-we-want-to-run-this-state> …