mount

promesante 2020-02-06T14:32:41.002400Z

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 !

tolitius 2020-02-06T17:55:12.002600Z

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

tolitius 2020-02-06T17:56:39.002900Z

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

promesante 2020-02-06T20:21:54.004300Z

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

promesante 2020-02-06T20:24:18.006700Z

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

promesante 2020-02-06T20:27:44.008800Z

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

tolitius 2020-02-06T20:42:03.011100Z

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

tolitius 2020-02-06T20:42:20.011500Z

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

tolitius 2020-02-06T20:42:25.011800Z

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

promesante 2020-02-06T20:50:18.012700Z

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