Wheat Wizard
Wheat Wizard

Reputation: 4219

Creating an event that fires only once

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?

Upvotes: 5

Views: 184

Answers (1)

user2847643
user2847643

Reputation: 2935

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.

Upvotes: 2

Related Questions