Remove MouseEvent fallback support
This commit is contained in:
parent
fbba203c4a
commit
a134a59917
8 changed files with 64 additions and 416 deletions
|
|
@ -1,7 +1,7 @@
|
|||
use wasm_bindgen::{prelude::Closure, JsCast};
|
||||
use web_sys::{AddEventListenerOptions, EventListenerOptions, EventTarget};
|
||||
use web_sys::{EventListenerOptions, EventTarget};
|
||||
|
||||
pub(super) struct EventListenerHandle<T: ?Sized> {
|
||||
pub struct EventListenerHandle<T: ?Sized> {
|
||||
target: EventTarget,
|
||||
event_type: &'static str,
|
||||
listener: Closure<T>,
|
||||
|
|
@ -24,31 +24,6 @@ impl<T: ?Sized> EventListenerHandle<T> {
|
|||
options: EventListenerOptions::new(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn with_options<U>(
|
||||
target: &U,
|
||||
event_type: &'static str,
|
||||
listener: Closure<T>,
|
||||
options: &AddEventListenerOptions,
|
||||
) -> Self
|
||||
where
|
||||
U: Clone + Into<EventTarget>,
|
||||
{
|
||||
let target = target.clone().into();
|
||||
target
|
||||
.add_event_listener_with_callback_and_add_event_listener_options(
|
||||
event_type,
|
||||
listener.as_ref().unchecked_ref(),
|
||||
options,
|
||||
)
|
||||
.expect("Failed to add event listener");
|
||||
EventListenerHandle {
|
||||
target,
|
||||
event_type,
|
||||
listener,
|
||||
options: options.clone().unchecked_into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: ?Sized> Drop for EventListenerHandle<T> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue