Skip to main content

web_sys/features/
gen_IntersectionObserver.rs

1#![allow(unused_imports)]
2#![allow(clippy::all)]
3use super::*;
4use wasm_bindgen::prelude::*;
5#[wasm_bindgen]
6extern "C" {
7    #[wasm_bindgen(
8        extends = "::js_sys::Object",
9        js_name = "IntersectionObserver",
10        typescript_type = "IntersectionObserver"
11    )]
12    #[derive(Debug, Clone, PartialEq, Eq)]
13    #[doc = "The `IntersectionObserver` class."]
14    #[doc = ""]
15    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver)"]
16    #[doc = ""]
17    #[doc = "*This API requires the following crate features to be activated: `IntersectionObserver`*"]
18    pub type IntersectionObserver;
19    #[cfg(feature = "Element")]
20    #[wasm_bindgen(method, getter, js_class = "IntersectionObserver", js_name = "root")]
21    #[doc = "Getter for the `root` field of this object."]
22    #[doc = ""]
23    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver/root)"]
24    #[doc = ""]
25    #[doc = "*This API requires the following crate features to be activated: `Element`, `IntersectionObserver`*"]
26    pub fn root(this: &IntersectionObserver) -> Option<Element>;
27    #[wasm_bindgen(
28        method,
29        getter,
30        js_class = "IntersectionObserver",
31        js_name = "rootMargin"
32    )]
33    #[doc = "Getter for the `rootMargin` field of this object."]
34    #[doc = ""]
35    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver/rootMargin)"]
36    #[doc = ""]
37    #[doc = "*This API requires the following crate features to be activated: `IntersectionObserver`*"]
38    pub fn root_margin(this: &IntersectionObserver) -> ::alloc::string::String;
39    #[wasm_bindgen(
40        method,
41        getter,
42        js_class = "IntersectionObserver",
43        js_name = "thresholds"
44    )]
45    #[doc = "Getter for the `thresholds` field of this object."]
46    #[doc = ""]
47    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver/thresholds)"]
48    #[doc = ""]
49    #[doc = "*This API requires the following crate features to be activated: `IntersectionObserver`*"]
50    pub fn thresholds(this: &IntersectionObserver) -> ::js_sys::Array;
51    #[wasm_bindgen(catch, constructor, js_class = "IntersectionObserver")]
52    #[doc = "The `new IntersectionObserver(..)` constructor, creating a new instance of `IntersectionObserver`."]
53    #[doc = ""]
54    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver/IntersectionObserver)"]
55    #[doc = ""]
56    #[doc = "*This API requires the following crate features to be activated: `IntersectionObserver`*"]
57    pub fn new(intersection_callback: &::js_sys::Function)
58        -> Result<IntersectionObserver, JsValue>;
59    #[cfg(feature = "IntersectionObserverInit")]
60    #[wasm_bindgen(catch, constructor, js_class = "IntersectionObserver")]
61    #[doc = "The `new IntersectionObserver(..)` constructor, creating a new instance of `IntersectionObserver`."]
62    #[doc = ""]
63    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver/IntersectionObserver)"]
64    #[doc = ""]
65    #[doc = "*This API requires the following crate features to be activated: `IntersectionObserver`, `IntersectionObserverInit`*"]
66    pub fn new_with_options(
67        intersection_callback: &::js_sys::Function,
68        options: &IntersectionObserverInit,
69    ) -> Result<IntersectionObserver, JsValue>;
70    #[wasm_bindgen(method, js_class = "IntersectionObserver")]
71    #[doc = "The `disconnect()` method."]
72    #[doc = ""]
73    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver/disconnect)"]
74    #[doc = ""]
75    #[doc = "*This API requires the following crate features to be activated: `IntersectionObserver`*"]
76    pub fn disconnect(this: &IntersectionObserver);
77    #[cfg(feature = "Element")]
78    #[wasm_bindgen(method, js_class = "IntersectionObserver")]
79    #[doc = "The `observe()` method."]
80    #[doc = ""]
81    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver/observe)"]
82    #[doc = ""]
83    #[doc = "*This API requires the following crate features to be activated: `Element`, `IntersectionObserver`*"]
84    pub fn observe(this: &IntersectionObserver, target: &Element);
85    #[wasm_bindgen(method, js_class = "IntersectionObserver", js_name = "takeRecords")]
86    #[doc = "The `takeRecords()` method."]
87    #[doc = ""]
88    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver/takeRecords)"]
89    #[doc = ""]
90    #[doc = "*This API requires the following crate features to be activated: `IntersectionObserver`*"]
91    pub fn take_records(this: &IntersectionObserver) -> ::js_sys::Array;
92    #[cfg(feature = "Element")]
93    #[wasm_bindgen(method, js_class = "IntersectionObserver")]
94    #[doc = "The `unobserve()` method."]
95    #[doc = ""]
96    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver/unobserve)"]
97    #[doc = ""]
98    #[doc = "*This API requires the following crate features to be activated: `Element`, `IntersectionObserver`*"]
99    pub fn unobserve(this: &IntersectionObserver, target: &Element);
100}