membrane

https://github.com/phronmophobic/membrane
genekim 2020-07-13T15:45:42.004300Z

Can you help me understand this better? When I think of hot code reloading, I usually think of something like figwheel or shadow-CLJS that is watching the filesystems, and automatically reloading the code when it changes. Are you suggesting that there's some way to do this with membrane? Even if not, I found myself quitting my membrane app (by clicking on the close window icon) whenever I had made a change to the program — is there a better way to do this? (Maybe I just need to have the app re-render the UI upon code changes somehow?) @smith.adriane

phronmophobic 2020-07-13T15:50:22.005Z

it depends on which editor you use. on the jvm, most editors allow you to spin up a repl and sent expressions to the repl to be reevaluated.

phronmophobic 2020-07-13T15:52:26.006600Z

I use emacs +cider/nrepl. My workflow is to typically run a window with the component I'm working on and use cider-eval-defun-at-point to update the ui as I'm working on it

genekim 2020-07-13T16:01:15.009600Z

Yep, I'm using Cursive/IntelliJ, and had the REPL reloading modified files. Is there a way I can tell the membrane app to re-render the views, or in the more extreme case, restart the application (without having to mouse over to manually close the app window)?

phronmophobic 2020-07-13T16:02:48.010100Z

the window should rerender whenever an event occurs or 0.5 seconds

phronmophobic 2020-07-13T16:03:37.011200Z

as long as your main is calling a function that can be redefined

phronmophobic 2020-07-13T16:04:32.012100Z

for example:

(defn my-app []
  (on
   :key-press
   (fn [s]
     (spit "test.log" (str "keypress: " s "\n") :append true)
     [[:keydown s]]
     )
   (ui/label "hello world4")))

(defn -main [& args]
  (dispatch [:initialize-db])  
  (skia/run #(memframe/re-frame-app (#'my-app))))

phronmophobic 2020-07-13T16:04:44.012400Z

you can then update my-app and see the changes

genekim 2020-07-13T16:05:03.012800Z

Oh! I'll check again — and holy cow, I didn't think of the possibility of running different windows to render isolated components. Very cool. (Gotta take a break to get some real work done today. But I'll be thinking about this all day long! :) Thx again!

phronmophobic 2020-07-13T16:07:09.014Z

I just edited the example (it was missing #' to make sure it gets the latest version of my-app

genekim 2020-07-13T16:08:16.014700Z

Inviting @logbot, to ensure that this channel gets into the Clojurians Slack Archive.

👍 1