dioxus_web/events/
animation.rs1use dioxus_html::HasAnimationData;
2use web_sys::AnimationEvent;
3
4use super::{Synthetic, WebEventExt};
5
6impl HasAnimationData for Synthetic<AnimationEvent> {
7 fn animation_name(&self) -> String {
8 self.event.animation_name()
9 }
10
11 fn pseudo_element(&self) -> String {
12 self.event.pseudo_element()
13 }
14
15 fn elapsed_time(&self) -> f32 {
16 self.event.elapsed_time()
17 }
18
19 fn as_any(&self) -> &dyn std::any::Any {
20 &self.event
21 }
22}
23
24impl WebEventExt for dioxus_html::AnimationData {
25 type WebEvent = web_sys::AnimationEvent;
26
27 #[inline(always)]
28 fn try_as_web_event(&self) -> Option<web_sys::AnimationEvent> {
29 self.downcast::<web_sys::AnimationEvent>().cloned()
30 }
31}