Fork me on GitHub
#membrane
<
2021-08-26
>
Jakub20:08:16

@smith.adriane finally got a chance to try it out, it works very well, thanks again 👍 One thing that I noticed using the re-frame wrapper is that with terminal-resized it does not work to use pure vectors to dispatch re-frame events like [[:some-event]] , but it is not a big deal because there is a simple workaround of using (dispatch [:some-event]) explicitly. So instead of:

(on :terminal-resized
    (fn [new-size]
      [[:set-terminal-size new-size]]))
I do:
(on :terminal-resized
    (fn [new-size]
      (dispatch [:set-terminal-size new-size])
      nil))

phronmophobic20:08:43

ah, ok. I added support for extensible events like terminal-resized in membrane.component, but not for re-frame. Just need to do the same thing in the membrane.re-frame

phronmophobic20:08:49

One thing I realized with the terminal-resized event is that you need to create the view before firing the :terminal-resized event and there's probably some use cases that want to know the size before creating the view

phronmophobic20:08:49

which makes me thing that having it as an event might not be the best fit and it should instead be a callback provided to membrane.lanterna/run

Jakub20:08:39

Maybe that could be a bit nicer, but I don't see a problem also with wrapping it like this for example:

(on :terminal-resized
    ...
    (when-some [[w h] @(subscribe [:size])]
      (vertical-layout ...)))