This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-03-01
Channels
- # announcements (2)
- # architecture (8)
- # babashka (21)
- # beginners (75)
- # calva (3)
- # clj-kondo (6)
- # cljdoc (6)
- # cljs-dev (10)
- # clojars (4)
- # clojure (94)
- # clojure-europe (12)
- # clojure-nl (4)
- # clojure-norway (3)
- # clojure-spec (6)
- # clojure-uk (4)
- # clojurescript (51)
- # community-development (13)
- # core-async (3)
- # css (1)
- # cursive (8)
- # datomic (7)
- # girouette (3)
- # graphql (3)
- # improve-getting-started (4)
- # integrant (2)
- # interop (5)
- # jobs (12)
- # kaocha (1)
- # lsp (24)
- # malli (4)
- # membrane (13)
- # nextjournal (9)
- # off-topic (6)
- # re-frame (9)
- # reitit (2)
- # remote-jobs (1)
- # reveal (4)
- # ring (4)
- # scittle (3)
- # shadow-cljs (4)
- # spacemacs (1)
- # testing (2)
- # vrac (1)
Can you offer advice on how to develop... iteratively? incrementally? live? whatever people call it... I want my code changes to get incorporated into the running app.
(defonce app (atom nil))
(defn view
[& args]
(ui/label "hi"))
(reset! app (java2d/run (component/make-app #'view)))
I have this ^
Even if I change something in view
and call ((:membrane.java2d/repaint @app))
nothing changes in the ui.@UPD88PGNT, You can try something like:
(defonce app (atom nil))
(defn view
[& args]
(ui/label "hi"))
(def window-info (java2d/run #'view))
(def repaint (::java2d/repaint window-info))
(add-watch #'view ::repaint
(fn [_ _ _ _]
(repaint)))
The issue is that component/make-app
only works with components created with component/defui
.
If you're not using defui
and friends, then you can just pass the function.
(defui view
[arg]
(basic/textarea {:text "hi"}))
(defonce window (java2d/run
(component/make-app #'view {})))
((:membrane.java2d/repaint window))
I can highlight the text but I can't edit it. I think I should be able to since the tutorial example shows editing the text in the gif.Oh.
(defui view
[{:keys [input]
:or {input ""}}]
(basic/textarea {:text input}))
I have to rerun the app if I change the name input
. I guess the app is populating :input in the context and if I redef the defui to use like :my-input then there's no data there.It looks like you figured it out, but since textareas are stateful components, the :text
property must be derived from some input property to "update" it.