Skip to main content

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    #[doc = "Change the `threshold` field of this object."]
46    #[doc = ""]
47    #[doc = "*This API requires the following crate features to be activated: `IntersectionObserverInit`*"]
48    #[wasm_bindgen(method, setter = "threshold")]
49    pub fn set_threshold_f64(this: &IntersectionObserverInit, val: f64);
50    #[doc = "Change the `threshold` field of this object."]
51    #[doc = ""]
52    #[doc = "*This API requires the following crate features to be activated: `IntersectionObserverInit`*"]
53    #[wasm_bindgen(method, setter = "threshold")]
54    pub fn set_threshold_f64_sequence(
55        this: &IntersectionObserverInit,
56        val: &::wasm_bindgen::JsValue,
57    );
58}
59impl IntersectionObserverInit {
60    #[doc = "Construct a new `IntersectionObserverInit`."]
61    #[doc = ""]
62    #[doc = "*This API requires the following crate features to be activated: `IntersectionObserverInit`*"]
63    pub fn new() -> Self {
64        #[allow(unused_mut)]
65        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
66        ret
67    }
68    #[cfg(feature = "Element")]
69    #[deprecated = "Use `set_root()` instead."]
70    pub fn root(&mut self, val: Option<&Element>) -> &mut Self {
71        self.set_root(val);
72        self
73    }
74    #[deprecated = "Use `set_root_margin()` instead."]
75    pub fn root_margin(&mut self, val: &str) -> &mut Self {
76        self.set_root_margin(val);
77        self
78    }
79    #[deprecated = "Use `set_threshold()` instead."]
80    pub fn threshold(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self {
81        self.set_threshold(val);
82        self
83    }
84}
85impl Default for IntersectionObserverInit {
86    fn default() -> Self {
87        Self::new()
88    }
89}