Event Trait #3124
Unanswered
Mehrbod2002
asked this question in
Q&A
Event Trait
#3124
Replies: 2 comments
-
There is an fn handle_event<T>(event: Event<T>) {
println!("event happened!);
event.stop_propagation();
} And it should be usable as something like: component {
onclick: move |evt: Event<MouseData>| {
handle_event(evt);
},
onkeydown: move |evt: Event<KeyboardData>| {
handle_event(evt);
},
} |
Beta Was this translation helpful? Give feedback.
0 replies
-
@ryo33 generic is choice but not while we want to pass signals through the function or borrow . we need closure function and we have to create function to through out implementation of closure with generic argument and obviously lifetime . event trait is better choice if exists in this repo . |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is there event trait to use it in handlers and callers ?
For example we have modal and we want to use keyboard event and mouse event as on click event to close it . By this we should define 2 function with same process.
Beta Was this translation helpful? Give feedback.
All reactions