[#5]: suspendable example app.. [done]

This commit is contained in:
anatoly 2015-11-21 14:04:15 -05:00
parent 9d7c5576f8
commit d1ba7908bf
2 changed files with 7 additions and 2 deletions

View file

@ -21,6 +21,7 @@
(mount/start)) (mount/start))
(defn stop [] (defn stop []
(mount/suspend)
(mount/stop-except #'app.www/nyse-app)) (mount/stop-except #'app.www/nyse-app))
(defn refresh [] (defn refresh []

View file

@ -27,10 +27,14 @@
(run-jetty {:join? false (run-jetty {:join? false
:port (:port www)}))) :port (:port www)})))
(declare nyse-app) ;; in case it needs to be accessed in "resume-nyse" (helping out Clojure compiler)
(defn resume-nyse [conf] (defn resume-nyse [conf]
;; making decision to whether call start / do something ro resume / or just do nothing ;; making decision to whether call start / do something / or resume / or just do nothing
;; access to the current (previous/old) state is here just by its name "nyse-app"
;; ... ;; ...
) (create-nyse-schema)
nyse-app) ;; returning an existing nyse-app, _so it can be stopped_, later on
(defstate nyse-app :start (start-nyse app-config) (defstate nyse-app :start (start-nyse app-config)
:resume (resume-nyse app-config) :resume (resume-nyse app-config)