This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-09-03
Channels
- # announcements (11)
- # atom-editor (8)
- # aws (16)
- # babashka (34)
- # beginners (59)
- # calva (32)
- # cider (8)
- # clj-kondo (43)
- # cljs-dev (52)
- # clojure (26)
- # clojure-europe (11)
- # clojure-italy (2)
- # clojure-nl (5)
- # clojure-spec (16)
- # clojure-uk (44)
- # clojurescript (5)
- # core-async (21)
- # cursive (14)
- # datomic (53)
- # figwheel-main (4)
- # fulcro (5)
- # graphql (6)
- # java (3)
- # kaocha (5)
- # leiningen (6)
- # local-first-clojure (1)
- # malli (25)
- # off-topic (40)
- # other-languages (1)
- # pathom (5)
- # pedestal (3)
- # re-frame (4)
- # reitit (2)
- # reveal (8)
- # rum (21)
- # sci (16)
- # shadow-cljs (90)
- # spacemacs (8)
- # tools-deps (10)
- # vrac (6)
- # xtdb (12)
I made a little demo that uses integrant to build a simple server, and it's state is managed in an agent
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
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!))}]}]})})
And here is how it can be viewed: note that it displays both the state and buttons to start/stop it