Skip to content

Commit

Permalink
Remove unused EventListenerOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
daxpedda committed Jun 11, 2023
1 parent f7a400d commit ab4a4a8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ features = [
'DomRect',
'Element',
'Event',
"EventListenerOptions",
'EventTarget',
'FocusEvent',
'HtmlCanvasElement',
Expand Down
7 changes: 2 additions & 5 deletions src/platform_impl/web/web_sys/event_handle.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
use wasm_bindgen::{prelude::Closure, JsCast};
use web_sys::{EventListenerOptions, EventTarget};
use web_sys::EventTarget;

pub struct EventListenerHandle<T: ?Sized> {
target: EventTarget,
event_type: &'static str,
listener: Closure<T>,
options: EventListenerOptions,
}

impl<T: ?Sized> EventListenerHandle<T> {
Expand All @@ -21,18 +20,16 @@ impl<T: ?Sized> EventListenerHandle<T> {
target,
event_type,
listener,
options: EventListenerOptions::new(),
}
}
}

impl<T: ?Sized> Drop for EventListenerHandle<T> {
fn drop(&mut self) {
self.target
.remove_event_listener_with_callback_and_event_listener_options(
.remove_event_listener_with_callback(
self.event_type,
self.listener.as_ref().unchecked_ref(),
&self.options,
)
.unwrap_or_else(|e| {
web_sys::console::error_2(
Expand Down

0 comments on commit ab4a4a8

Please sign in to comment.