Skip to content

Comments

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

Open
martinklepsch wants to merge 1 commit intotolitius:masterfrom
martinklepsch:patch-1
Open

Deref mount state var in :stop function in readme?#127
martinklepsch wants to merge 1 commit intotolitius:masterfrom
martinklepsch:patch-1

Conversation

@martinklepsch
Copy link

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
Copy link
Owner

tolitius commented Nov 7, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants