maxcountryman_web_sys/features/
gen_IntersectionObserverInit.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 = IntersectionObserverInit)]
7    #[derive(Debug, Clone, PartialEq, Eq)]
8    #[doc = "The `IntersectionObserverInit` dictionary."]
9    #[doc = ""]
10    #[doc = "*This API requires the following crate features to be activated: `IntersectionObserverInit`*"]
11    pub type IntersectionObserverInit;
12}
13impl IntersectionObserverInit {
14    #[doc = "Construct a new `IntersectionObserverInit`."]
15    #[doc = ""]
16    #[doc = "*This API requires the following crate features to be activated: `IntersectionObserverInit`*"]
17    pub fn new() -> Self {
18        #[allow(unused_mut)]
19        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
20        ret
21    }
22    #[cfg(feature = "Element")]
23    #[doc = "Change the `root` field of this object."]
24    #[doc = ""]
25    #[doc = "*This API requires the following crate features to be activated: `Element`, `IntersectionObserverInit`*"]
26    pub fn root(&mut self, val: Option<&Element>) -> &mut Self {
27        use wasm_bindgen::JsValue;
28        let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("root"), &JsValue::from(val));
29        debug_assert!(
30            r.is_ok(),
31            "setting properties should never fail on our dictionary objects"
32        );
33        let _ = r;
34        self
35    }
36    #[doc = "Change the `rootMargin` field of this object."]
37    #[doc = ""]
38    #[doc = "*This API requires the following crate features to be activated: `IntersectionObserverInit`*"]
39    pub fn root_margin(&mut self, val: &str) -> &mut Self {
40        use wasm_bindgen::JsValue;
41        let r = ::js_sys::Reflect::set(
42            self.as_ref(),
43            &JsValue::from("rootMargin"),
44            &JsValue::from(val),
45        );
46        debug_assert!(
47            r.is_ok(),
48            "setting properties should never fail on our dictionary objects"
49        );
50        let _ = r;
51        self
52    }
53    #[doc = "Change the `threshold` field of this object."]
54    #[doc = ""]
55    #[doc = "*This API requires the following crate features to be activated: `IntersectionObserverInit`*"]
56    pub fn threshold(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self {
57        use wasm_bindgen::JsValue;
58        let r = ::js_sys::Reflect::set(
59            self.as_ref(),
60            &JsValue::from("threshold"),
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}
71impl Default for IntersectionObserverInit {
72    fn default() -> Self {
73        Self::new()
74    }
75}