Fork me on GitHub
#reveal
<
2020-09-03
>
vlaaad20:09:55

ah, I can't wait to finish writing the docs, it's turning out so nice

vlaaad20:09:16

so many interesting possibilities

vlaaad20:09:58

I made a little demo that uses integrant to build a simple server, and it's state is managed in an agent

vlaaad20:09:36

using very little code, I can make a monitor of that system that both shows it's state and contains controls to start it and stop it

vlaaad20:09:05

e.g.:

(re/viewed-as-is
  {:fx/type re/observable-view
   :ref system
   :fn (fn [state]
         {:fx/type :v-box
          :children [{:fx/type re/value-view
                      :v-box/vgrow :always
                      :value state}
                     {:fx/type :h-box
                      :children [{:fx/type :button
                                  :disable (not state)
                                  :text "Stop"
                                  :on-action (fn [_] (stop!))}
                                 {:fx/type :button
                                  :disable (some? state)
                                  :text "Start"
                                  :on-action (fn [_] (start!))}]}]})})

vlaaad20:09:46

And here is how it can be viewed: note that it displays both the state and buttons to start/stop it

vlaaad20:09:39

and whenever the system is started/stopped from the repl, this view is immediately updated

vlaaad20:09:22

"build your own watcher"