Enable event propagation (#3062)
This commit is contained in:
parent
7541220a41
commit
1dfca5a395
7 changed files with 75 additions and 176 deletions
|
|
@ -8,11 +8,11 @@ pub struct EventListenerHandle<T: ?Sized> {
|
|||
}
|
||||
|
||||
impl<T: ?Sized> EventListenerHandle<T> {
|
||||
pub fn new<U>(target: &U, event_type: &'static str, listener: Closure<T>) -> Self
|
||||
pub fn new<U>(target: U, event_type: &'static str, listener: Closure<T>) -> Self
|
||||
where
|
||||
U: Clone + Into<EventTarget>,
|
||||
U: Into<EventTarget>,
|
||||
{
|
||||
let target = target.clone().into();
|
||||
let target = target.into();
|
||||
target
|
||||
.add_event_listener_with_callback(event_type, listener.as_ref().unchecked_ref())
|
||||
.expect("Failed to add event listener");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue