Fork me on GitHub
#mount
<
2017-07-17
>
mike_ananev10:07:58

Hi! Is there any way to run state for whole namespace? I have several states in one namespace "helloworld". I would like to point out only name of namespace to run all states in it instead of enumaration every defstate

arnout12:07:02

No, but it could easily be added/programmed by yourself.

dm314:07:14

Using some internals

(defn states-in-ns [ns-sym]
    (let [all (set (map :var (vals @@#'mount.core/meta-state)))]
       (filter all (vals (ns-publics ns-sym)))))

dm314:07:46

(apply mount.core/start (states-in-ns 'my.ns))

dm314:07:32

there’s actually mount.core/find-all-states that you can use instead of accessing the private meta-state

mike_ananev16:07:29

@dm3 thanks, I'll try it.