Fork me on GitHub
#mount
<
2020-02-06
>
promesante14:02:41

hi, does anybody know about a tutorial or demo of mount implemented on a re-frame Clojurescript SPA with config so that the application can be start/stop/reset from REPL? Closest ones I have found out so far are: 1. example included in mount's distribution https://github.com/tolitius/mount/blob/master/doc/clojurescript.md#mounting-that-clojurescript https://github.com/tolitius/mount/tree/master/dev/cljs/app it is not integrated with re-frame, and not seem to implement start/stop/reset from REPL 2. Luminus template https://github.com/luminus-framework/luminus-template integrated with re-frame, but doesn't seem to implement start/stop/reset from REPL Thanks in advance !

tolitius17:02:12

what do you mean by start/stop/reset from REPL ?

tolitius17:02:39

see if any of these examples help: https://github.com/tolitius/stater

promesante20:02:54

an example of what I mean by REPL config is the one, supplied with mount:

promesante20:02:18

it is implemented in clojure; what I asked about is a similar one, but for clojurescript / re-frame, as far as I have been exploring, none is supplied in mount

promesante20:02:44

on the other side, examples in slater are mainly in clojure, with the exception of hubble, but even in hubble, I have not been able to found out mount implemented on clojurescript side of the example

tolitius20:02:03

the reset is hooked into tools.namespace which is a library that refreshes namespaces in Clojure. in ClojureScript you would usually use a reload library figwheel or boot-cljs / boot-reload since things happen in the browser

tolitius20:02:20

as to a simple restart, if you want a single function you could do something like:

tolitius20:02:25

(defn reset
  "stops all states defined by defstate and starts them again"
  []
  (mount/stop)
  (mount/start))

promesante20:02:18

ok, so I will follow these suggestions, thank you very much for such a quick reply