adding "defstate!" wrapper (per @DomKM)
This commit is contained in:
parent
c1be3c377e
commit
eeda080322
2 changed files with 51 additions and 42 deletions
|
|
@ -147,6 +147,15 @@
|
|||
:var (var ~state)))
|
||||
(var ~state))))))
|
||||
|
||||
#?(:clj
|
||||
(defmacro defstate! [state & {:keys [start! stop!]}]
|
||||
(let [state-name (with-ns *ns* state)]
|
||||
`(defstate ~state
|
||||
:start (~'let [~state (mount/current-state ~state-name)]
|
||||
~start!)
|
||||
:stop (~'let [~state (mount/current-state ~state-name)]
|
||||
~stop!)))))
|
||||
|
||||
(defn in-cljc-mode []
|
||||
(reset! mode :cljc))
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue