Fork me on GitHub
#mount
<
2017-03-28
>
kurt-o-sys09:03:04

Does mount have a kind of ls of all mounted states? Something that could look like:

(mount/ls)
{#'app.config/config #'app.nyse/conn
 #'app.sms/send-sms send-sms
 ...}
so one can check which states are loaded with which values.

tolitius11:03:26

=> (require '[mount.tools.graph :as g])
=> (g/states-with-deps)
({:name "#'app.conf/config", :order 1, :status #{:started}, :deps #{}}
 {:name "#'app.db/conn",
  :order 2,
  :status #{:started},
  :deps #{"#'app.conf/config"}}
 {:name "#'app.www/nyse-app",
  :order 3,
  :status #{:started},
  :deps #{"#'app.conf/config" "#'app.db/conn"}}
 {:name "#'app.example/nrepl",
  :order 4,
  :status #{:started},
  :deps #{"#'app.conf/config"}})

kurt-o-sys11:03:13

oh, cool! Much better than what I had in mind. Perfect. Thx.

tolitius11:03:19

there is also:

=> (mount/running-states)
#{"#'app.www/nyse-app" "#'app.example/nrepl" "#'app.conf/config" "#'app.db/conn"}

tolitius11:03:28

sure, welcome

tolitius11:03:17

(the first one only works in .clj (i.e. not .cljs) at the moment)

kurt-o-sys11:03:17

it is for .clj, so well, wicked-awesome 🙂

arnout14:03:21

Unfortunately I can't remember who it was, but he/she asked me some weeks ago how mount-lite 2.0 can play nice with the tools.namespace contrib library. The question was about refreshing the project, without restarting all the states when only a few might be reloaded.

arnout14:03:47

Today I added a new extension to mount-lite 2.0 that helps with this: https://github.com/aroemers/mount-lite/blob/2.x/src/mount/extensions/refresh.clj