I find myself in desire of a function with the signature:
-- VtyWidget is from https://github.com/reflex-frp/reflex-vty
now :: a -> VtyWidget t m (Event t a)
For some m
. This function would take an element and produce a widget which fires an event once, immediately.
I cannot find such a function or any things that I could use to build this.
I can build things of this type like:
const (pure never)
But that ignores the input and never fires an event.
Is there a way to do this? Or am I not supposed to do this sort of thing?
Using the once option We can pass an object as an argument to the addEventListener method and specify that the event is only handled once. This is achieved by passing the property once to the object. If we set once to true, the event will only be fired once.
Using once() Sometimes you want your application to respond to an event (or type of event) only one time (i.e., the first time the event occurs). To do this, Node provides the once() method. It is used just like the addListener() and on() methods, but allows for responding to the event only once.
The method addEventListener() works by adding a function, or an object that implements EventListener , to the list of event listeners for the specified event type on the EventTarget on which it's called.
jQuery one() Method The one() method attaches one or more event handlers for the selected elements, and specifies a function to run when the event occurs. When using the one() method, the event handler function is only run ONCE for each element.
I'm not sure I fully understand the question but it vaguely sounds like you may want getPostBuild
. That is what I use whenever I want things to happen once during initialization of a widget.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With