Open cormac-ainc opened 1 year ago
I'd love to see something like axum's handler fn's here where certain kinds of functions map to different eventhandlers
I’m looking for the ability to pass a boolean flag, maybe leaving room for a couple more booleans from that options object. A highly generic type-level function argument extractor mechanism would be overkill.
Specific Demand
On the web,
EventTarget.addEventListener
has an extra argument that is either an options object or a boolean. The boolean is known asuseCapture
, passingtrue
is equivalent to{ capture: true }
.When you do this, quoting MDN:
I wish to be able to set an event handler in dioxus with the capture flag set to true, and have the synthetic event system figure out the details.
Implement Suggestion
EventHandler is already a struct with a call() method, right?. I assume it has a From impl for closures of the right type? If so, just let people construct an EventHandler explicitly and include the options in the constructor (or a builder pattern).