react-blessed
react-blessed copied to clipboard
Always include node in event callbacks
This is a big change, but I think it would make development a lot more pleasant.
Similar to working with React in a browser context, there are a lot of
reasons that having a reference to a Node
is useful.
One of the most basic React DOM cases is text inputs. You create the
input, and use event.target.value
to set the state of your
component.
In react-blessed, having access to nodes in events would be useful,
but they're largely not available (except focus
and blur
events).
Because of this, I end up needing to create refs for almost every element, which isn't necessarily bad, but my preference would be to just have access to the node in event callbacks.
Please let me know what you think of this change!
Hello @danielma. Thanks for your PR. I need to check the event emitting code again though. I don't remember what was chosen and how it worked. I guess we should give access to the blessed event data but I don't remember what blessed yield as event.
As far as I can tell from looking at blessed, this would give us full access to everything from blessed. Every blessed Node
extends from EventEmitter
, which recommends using this
to get access to the emitter instance.
So there's no way in blessed to access current node in an event handler without needing to hit this
? The payload never provides it?
@Yomguithereal yep, that's correct as far as I'm aware
👍 I'd like to see this happen as well.
Can someone checks if blessed evolved regarding this matter? I did not track its most recent updates.
@Yomguithereal blessed hasn't been updated in over 3 years.