maxcountryman_web_sys/features/
gen_IntersectionObserverEntryInit.rs

1#![allow(unused_imports)]
2use super::*;
3use wasm_bindgen::prelude::*;
4#[wasm_bindgen]
5extern "C" {
6    # [wasm_bindgen (extends = :: js_sys :: Object , js_name = IntersectionObserverEntryInit)]
7    #[derive(Debug, Clone, PartialEq, Eq)]
8    #[doc = "The `IntersectionObserverEntryInit` dictionary."]
9    #[doc = ""]
10    #[doc = "*This API requires the following crate features to be activated: `IntersectionObserverEntryInit`*"]
11    pub type IntersectionObserverEntryInit;
12}
13impl IntersectionObserverEntryInit {
14    #[cfg(all(feature = "DomRectInit", feature = "Element",))]
15    #[doc = "Construct a new `IntersectionObserverEntryInit`."]
16    #[doc = ""]
17    #[doc = "*This API requires the following crate features to be activated: `DomRectInit`, `Element`, `IntersectionObserverEntryInit`*"]
18    pub fn new(
19        bounding_client_rect: &DomRectInit,
20        intersection_rect: &DomRectInit,
21        root_bounds: &DomRectInit,
22        target: &Element,
23        time: f64,
24    ) -> Self {
25        #[allow(unused_mut)]
26        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
27        ret.bounding_client_rect(bounding_client_rect);
28        ret.intersection_rect(intersection_rect);
29        ret.root_bounds(root_bounds);
30        ret.target(target);
31        ret.time(time);
32        ret
33    }
34    #[cfg(feature = "DomRectInit")]
35    #[doc = "Change the `boundingClientRect` field of this object."]
36    #[doc = ""]
37    #[doc = "*This API requires the following crate features to be activated: `DomRectInit`, `IntersectionObserverEntryInit`*"]
38    pub fn bounding_client_rect(&mut self, val: &DomRectInit) -> &mut Self {
39        use wasm_bindgen::JsValue;
40        let r = ::js_sys::Reflect::set(
41            self.as_ref(),
42            &JsValue::from("boundingClientRect"),
43            &JsValue::from(val),
44        );
45        debug_assert!(
46            r.is_ok(),
47            "setting properties should never fail on our dictionary objects"
48        );
49        let _ = r;
50        self
51    }
52    #[cfg(feature = "DomRectInit")]
53    #[doc = "Change the `intersectionRect` field of this object."]
54    #[doc = ""]
55    #[doc = "*This API requires the following crate features to be activated: `DomRectInit`, `IntersectionObserverEntryInit`*"]
56    pub fn intersection_rect(&mut self, val: &DomRectInit) -> &mut Self {
57        use wasm_bindgen::JsValue;
58        let r = ::js_sys::Reflect::set(
59            self.as_ref(),
60            &JsValue::from("intersectionRect"),
61            &JsValue::from(val),
62        );
63        debug_assert!(
64            r.is_ok(),
65            "setting properties should never fail on our dictionary objects"
66        );
67        let _ = r;
68        self
69    }
70    #[cfg(feature = "DomRectInit")]
71    #[doc = "Change the `rootBounds` field of this object."]
72    #[doc = ""]
73    #[doc = "*This API requires the following crate features to be activated: `DomRectInit`, `IntersectionObserverEntryInit`*"]
74    pub fn root_bounds(&mut self, val: &DomRectInit) -> &mut Self {
75        use wasm_bindgen::JsValue;
76        let r = ::js_sys::Reflect::set(
77            self.as_ref(),
78            &JsValue::from("rootBounds"),
79            &JsValue::from(val),
80        );
81        debug_assert!(
82            r.is_ok(),
83            "setting properties should never fail on our dictionary objects"
84        );
85        let _ = r;
86        self
87    }
88    #[cfg(feature = "Element")]
89    #[doc = "Change the `target` field of this object."]
90    #[doc = ""]
91    #[doc = "*This API requires the following crate features to be activated: `Element`, `IntersectionObserverEntryInit`*"]
92    pub fn target(&mut self, val: &Element) -> &mut Self {
93        use wasm_bindgen::JsValue;
94        let r =
95            ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("target"), &JsValue::from(val));
96        debug_assert!(
97            r.is_ok(),
98            "setting properties should never fail on our dictionary objects"
99        );
100        let _ = r;
101        self
102    }
103    #[doc = "Change the `time` field of this object."]
104    #[doc = ""]
105    #[doc = "*This API requires the following crate features to be activated: `IntersectionObserverEntryInit`*"]
106    pub fn time(&mut self, val: f64) -> &mut Self {
107        use wasm_bindgen::JsValue;
108        let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("time"), &JsValue::from(val));
109        debug_assert!(
110            r.is_ok(),
111            "setting properties should never fail on our dictionary objects"
112        );
113        let _ = r;
114        self
115    }
116}