tolitius / mount

managing Clojure and ClojureScript app state since (reset)
Eclipse Public License 1.0
1.22k stars 88 forks source link

Deref mount state var in :stop function in readme? #127

Open martinklepsch opened 1 year ago

martinklepsch commented 1 year ago

This could be either a question or a documentation fix. In my nodejs/cljs usage of mount I found that I need to deref the var that I define with defstate in the :stop function. Is this correct and the documentation should be updated?

Could also a difference between Clojure and ClojureScript maybe?

tolitius commented 1 year ago

a state would only needed to be dereffed "in-cljc-mode" here are some docs with an example on starting / stopping / using the state in this mode.

I can see how the "front page" doc may be misleading if ClojureScript is the only env, which is unusual, but probable :) instead of altering it, we can add a note on a bottom:


(defstate conn :start (create-conn)
               :stop (disconnect conn))

or ":stop (disconnect @conn)" in case of ClojureScript. more cljs docs here

feel free to add it, or I can do it