Fix as web event (#3178)

This commit is contained in:
Evan Almloff authored and GitHub committed 2024-11-06 23:53:56 -05:00
1 parent 416811ba3a
commit 5186d8dded
15 files changed
+16 -32

No files matched your search

+1 -2
View File
@@ -26,7 +26,6 @@ impl WebEventExt for dioxus_html::AnimationData {
#[inline(always)] #[inline(always)]
fn try_as_web_event(&self) -> Option<web_sys::AnimationEvent> { fn try_as_web_event(&self) -> Option<web_sys::AnimationEvent> {
self.downcast::<Synthetic<web_sys::AnimationEvent>>() self.downcast::<web_sys::AnimationEvent>().cloned()
.map(|e| e.event.clone())
} }
} }
+1 -2
View File
@@ -20,7 +20,6 @@ impl WebEventExt for dioxus_html::ClipboardData {
#[inline(always)] #[inline(always)]
fn try_as_web_event(&self) -> Option<Self::WebEvent> { fn try_as_web_event(&self) -> Option<Self::WebEvent> {
self.downcast::<Synthetic<web_sys::Event>>() self.downcast::<web_sys::Event>().cloned()
.map(|e| e.event.clone())
} }
} }
+1 -2
View File
@@ -18,7 +18,6 @@ impl WebEventExt for dioxus_html::CompositionData {
#[inline(always)] #[inline(always)]
fn try_as_web_event(&self) -> Option<Self::WebEvent> { fn try_as_web_event(&self) -> Option<Self::WebEvent> {
self.downcast::<Synthetic<web_sys::CompositionEvent>>() self.downcast::<web_sys::CompositionEvent>().cloned()
.map(|e| e.event.clone())
} }
} }
+1 -2
View File
@@ -101,7 +101,6 @@ impl WebEventExt for dioxus_html::DragData {
#[inline(always)] #[inline(always)]
fn try_as_web_event(&self) -> Option<web_sys::DragEvent> { fn try_as_web_event(&self) -> Option<web_sys::DragEvent> {
self.downcast::<Synthetic<DragEvent>>() self.downcast::<DragEvent>().cloned()
.map(|data| data.event.clone())
} }
} }
+1 -2
View File
@@ -13,7 +13,6 @@ impl WebEventExt for dioxus_html::FocusData {
#[inline(always)] #[inline(always)]
fn try_as_web_event(&self) -> Option<Self::WebEvent> { fn try_as_web_event(&self) -> Option<Self::WebEvent> {
self.downcast::<Synthetic<web_sys::FocusEvent>>() self.downcast::<web_sys::FocusEvent>().cloned()
.map(|e| e.event.clone())
} }
} }
+1 -2
View File
@@ -61,7 +61,6 @@ impl WebEventExt for dioxus_html::KeyboardData {
#[inline(always)] #[inline(always)]
fn try_as_web_event(&self) -> Option<web_sys::KeyboardEvent> { fn try_as_web_event(&self) -> Option<web_sys::KeyboardEvent> {
self.downcast::<Synthetic<web_sys::KeyboardEvent>>() self.downcast::<web_sys::KeyboardEvent>().cloned()
.map(|e| e.event.clone())
} }
} }
+1 -2
View File
@@ -12,7 +12,6 @@ impl WebEventExt for dioxus_html::MediaData {
#[inline(always)] #[inline(always)]
fn try_as_web_event(&self) -> Option<Self::WebEvent> { fn try_as_web_event(&self) -> Option<Self::WebEvent> {
self.downcast::<Synthetic<web_sys::Event>>() self.downcast::<web_sys::Event>().cloned()
.map(|e| e.event.clone())
} }
} }
+1 -2
View File
@@ -120,7 +120,6 @@ impl WebEventExt for MountedData {
#[inline(always)] #[inline(always)]
fn try_as_web_event(&self) -> Option<web_sys::Element> { fn try_as_web_event(&self) -> Option<web_sys::Element> {
self.downcast::<Synthetic<web_sys::Element>>() self.downcast::<web_sys::Element>().cloned()
.map(|e| e.event.clone())
} }
} }
+1 -2
View File
@@ -73,7 +73,6 @@ impl WebEventExt for dioxus_html::MouseData {
#[inline(always)] #[inline(always)]
fn try_as_web_event(&self) -> Option<web_sys::MouseEvent> { fn try_as_web_event(&self) -> Option<web_sys::MouseEvent> {
self.downcast::<Synthetic<web_sys::MouseEvent>>() self.downcast::<web_sys::MouseEvent>().cloned()
.map(|e| e.event.clone())
} }
} }
+1 -2
View File
@@ -113,7 +113,6 @@ impl WebEventExt for dioxus_html::PointerData {
#[inline(always)] #[inline(always)]
fn try_as_web_event(&self) -> Option<web_sys::PointerEvent> { fn try_as_web_event(&self) -> Option<web_sys::PointerEvent> {
self.downcast::<Synthetic<web_sys::PointerEvent>>() self.downcast::<web_sys::PointerEvent>().cloned()
.map(|e| e.event.clone())
} }
} }
+1 -2
View File
@@ -39,8 +39,7 @@ impl WebEventExt for dioxus_html::ResizeData {
#[inline(always)] #[inline(always)]
fn try_as_web_event(&self) -> Option<web_sys::ResizeObserverEntry> { fn try_as_web_event(&self) -> Option<web_sys::ResizeObserverEntry> {
self.downcast::<Synthetic<web_sys::ResizeObserverEntry>>() self.downcast::<web_sys::ResizeObserverEntry>().cloned()
.map(|e| e.event.clone())
} }
} }
+1 -2
View File
@@ -12,7 +12,6 @@ impl WebEventExt for dioxus_html::SelectionData {
#[inline(always)] #[inline(always)]
fn try_as_web_event(&self) -> Option<Self::WebEvent> { fn try_as_web_event(&self) -> Option<Self::WebEvent> {
self.downcast::<Synthetic<web_sys::Event>>() self.downcast::<web_sys::Event>().cloned()
.map(|e| e.event.clone())
} }
} }
+1 -2
View File
@@ -12,7 +12,6 @@ impl WebEventExt for dioxus_html::ToggleData {
#[inline(always)] #[inline(always)]
fn try_as_web_event(&self) -> Option<Self::WebEvent> { fn try_as_web_event(&self) -> Option<Self::WebEvent> {
self.downcast::<Synthetic<web_sys::Event>>() self.downcast::<web_sys::Event>().cloned()
.map(|e| e.event.clone())
} }
} }
+1 -2
View File
@@ -105,7 +105,6 @@ impl WebEventExt for dioxus_html::TouchData {
#[inline(always)] #[inline(always)]
fn try_as_web_event(&self) -> Option<web_sys::TouchEvent> { fn try_as_web_event(&self) -> Option<web_sys::TouchEvent> {
self.downcast::<Synthetic<web_sys::TouchEvent>>() self.downcast::<web_sys::TouchEvent>().cloned()
.map(|e| e.event.clone())
} }
} }
+2 -4
View File
@@ -94,8 +94,7 @@ impl WebEventExt for dioxus_html::ScrollData {
#[inline(always)] #[inline(always)]
fn try_as_web_event(&self) -> Option<Self::WebEvent> { fn try_as_web_event(&self) -> Option<Self::WebEvent> {
self.downcast::<Synthetic<web_sys::Event>>() self.downcast::<web_sys::Event>().cloned()
.map(|e| e.event.clone())
} }
} }
@@ -104,7 +103,6 @@ impl WebEventExt for dioxus_html::WheelData {
#[inline(always)] #[inline(always)]
fn try_as_web_event(&self) -> Option<Self::WebEvent> { fn try_as_web_event(&self) -> Option<Self::WebEvent> {
self.downcast::<Synthetic<web_sys::WheelEvent>>() self.downcast::<web_sys::WheelEvent>().cloned()
.map(|e| e.event.clone())
} }
} }