web_sys/features/
gen_ScrollToOptions.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 = ScrollToOptions)]
8    #[derive(Debug, Clone, PartialEq, Eq)]
9    #[doc = "The `ScrollToOptions` dictionary."]
10    #[doc = ""]
11    #[doc = "*This API requires the following crate features to be activated: `ScrollToOptions`*"]
12    pub type ScrollToOptions;
13    #[cfg(feature = "ScrollBehavior")]
14    #[doc = "Get the `behavior` field of this object."]
15    #[doc = ""]
16    #[doc = "*This API requires the following crate features to be activated: `ScrollBehavior`, `ScrollToOptions`*"]
17    #[wasm_bindgen(method, getter = "behavior")]
18    pub fn get_behavior(this: &ScrollToOptions) -> Option<ScrollBehavior>;
19    #[cfg(feature = "ScrollBehavior")]
20    #[doc = "Change the `behavior` field of this object."]
21    #[doc = ""]
22    #[doc = "*This API requires the following crate features to be activated: `ScrollBehavior`, `ScrollToOptions`*"]
23    #[wasm_bindgen(method, setter = "behavior")]
24    pub fn set_behavior(this: &ScrollToOptions, val: ScrollBehavior);
25    #[doc = "Get the `left` field of this object."]
26    #[doc = ""]
27    #[doc = "*This API requires the following crate features to be activated: `ScrollToOptions`*"]
28    #[wasm_bindgen(method, getter = "left")]
29    pub fn get_left(this: &ScrollToOptions) -> Option<f64>;
30    #[doc = "Change the `left` field of this object."]
31    #[doc = ""]
32    #[doc = "*This API requires the following crate features to be activated: `ScrollToOptions`*"]
33    #[wasm_bindgen(method, setter = "left")]
34    pub fn set_left(this: &ScrollToOptions, val: f64);
35    #[doc = "Get the `top` field of this object."]
36    #[doc = ""]
37    #[doc = "*This API requires the following crate features to be activated: `ScrollToOptions`*"]
38    #[wasm_bindgen(method, getter = "top")]
39    pub fn get_top(this: &ScrollToOptions) -> Option<f64>;
40    #[doc = "Change the `top` field of this object."]
41    #[doc = ""]
42    #[doc = "*This API requires the following crate features to be activated: `ScrollToOptions`*"]
43    #[wasm_bindgen(method, setter = "top")]
44    pub fn set_top(this: &ScrollToOptions, val: f64);
45}
46impl ScrollToOptions {
47    #[doc = "Construct a new `ScrollToOptions`."]
48    #[doc = ""]
49    #[doc = "*This API requires the following crate features to be activated: `ScrollToOptions`*"]
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 = "ScrollBehavior")]
56    #[deprecated = "Use `set_behavior()` instead."]
57    pub fn behavior(&mut self, val: ScrollBehavior) -> &mut Self {
58        self.set_behavior(val);
59        self
60    }
61    #[deprecated = "Use `set_left()` instead."]
62    pub fn left(&mut self, val: f64) -> &mut Self {
63        self.set_left(val);
64        self
65    }
66    #[deprecated = "Use `set_top()` instead."]
67    pub fn top(&mut self, val: f64) -> &mut Self {
68        self.set_top(val);
69        self
70    }
71}
72impl Default for ScrollToOptions {
73    fn default() -> Self {
74        Self::new()
75    }
76}