web_sys/features/
gen_IntersectionObserverInit.rs

1#![allow(unused_imports)]
2#![allow(clippy::all)]
3use super::*;
4use wasm_bindgen::prelude::*;
5#[wasm_bindgen]
6extern "C" {
7    # [wasm_bindgen (extends = :: js_sys :: Object , js_name = IntersectionObserverInit)]
8    #[derive(Debug, Clone, PartialEq, Eq)]
9    #[doc = "The `IntersectionObserverInit` dictionary."]
10    #[doc = ""]
11    #[doc = "*This API requires the following crate features to be activated: `IntersectionObserverInit`*"]
12    pub type IntersectionObserverInit;
13    #[cfg(feature = "Element")]
14    #[doc = "Get the `root` field of this object."]
15    #[doc = ""]
16    #[doc = "*This API requires the following crate features to be activated: `Element`, `IntersectionObserverInit`*"]
17    #[wasm_bindgen(method, getter = "root")]
18    pub fn get_root(this: &IntersectionObserverInit) -> Option<Element>;
19    #[cfg(feature = "Element")]
20    #[doc = "Change the `root` field of this object."]
21    #[doc = ""]
22    #[doc = "*This API requires the following crate features to be activated: `Element`, `IntersectionObserverInit`*"]
23    #[wasm_bindgen(method, setter = "root")]
24    pub fn set_root(this: &IntersectionObserverInit, val: Option<&Element>);
25    #[doc = "Get the `rootMargin` field of this object."]
26    #[doc = ""]
27    #[doc = "*This API requires the following crate features to be activated: `IntersectionObserverInit`*"]
28    #[wasm_bindgen(method, getter = "rootMargin")]
29    pub fn get_root_margin(this: &IntersectionObserverInit) -> Option<::alloc::string::String>;
30    #[doc = "Change the `rootMargin` field of this object."]
31    #[doc = ""]
32    #[doc = "*This API requires the following crate features to be activated: `IntersectionObserverInit`*"]
33    #[wasm_bindgen(method, setter = "rootMargin")]
34    pub fn set_root_margin(this: &IntersectionObserverInit, val: &str);
35    #[doc = "Get the `threshold` field of this object."]
36    #[doc = ""]
37    #[doc = "*This API requires the following crate features to be activated: `IntersectionObserverInit`*"]
38    #[wasm_bindgen(method, getter = "threshold")]
39    pub fn get_threshold(this: &IntersectionObserverInit) -> ::wasm_bindgen::JsValue;
40    #[doc = "Change the `threshold` field of this object."]
41    #[doc = ""]
42    #[doc = "*This API requires the following crate features to be activated: `IntersectionObserverInit`*"]
43    #[wasm_bindgen(method, setter = "threshold")]
44    pub fn set_threshold(this: &IntersectionObserverInit, val: &::wasm_bindgen::JsValue);
45}
46impl IntersectionObserverInit {
47    #[doc = "Construct a new `IntersectionObserverInit`."]
48    #[doc = ""]
49    #[doc = "*This API requires the following crate features to be activated: `IntersectionObserverInit`*"]
50    pub fn new() -> Self {
51        #[allow(unused_mut)]
52        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
53        ret
54    }
55    #[cfg(feature = "Element")]
56    #[deprecated = "Use `set_root()` instead."]
57    pub fn root(&mut self, val: Option<&Element>) -> &mut Self {
58        self.set_root(val);
59        self
60    }
61    #[deprecated = "Use `set_root_margin()` instead."]
62    pub fn root_margin(&mut self, val: &str) -> &mut Self {
63        self.set_root_margin(val);
64        self
65    }
66    #[deprecated = "Use `set_threshold()` instead."]
67    pub fn threshold(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self {
68        self.set_threshold(val);
69        self
70    }
71}
72impl Default for IntersectionObserverInit {
73    fn default() -> Self {
74        Self::new()
75    }
76}