maxcountryman_web_sys/features/
gen_ShadowRootInit.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 = ShadowRootInit)]
7    #[derive(Debug, Clone, PartialEq, Eq)]
8    #[doc = "The `ShadowRootInit` dictionary."]
9    #[doc = ""]
10    #[doc = "*This API requires the following crate features to be activated: `ShadowRootInit`*"]
11    pub type ShadowRootInit;
12}
13impl ShadowRootInit {
14    #[cfg(feature = "ShadowRootMode")]
15    #[doc = "Construct a new `ShadowRootInit`."]
16    #[doc = ""]
17    #[doc = "*This API requires the following crate features to be activated: `ShadowRootInit`, `ShadowRootMode`*"]
18    pub fn new(mode: ShadowRootMode) -> Self {
19        #[allow(unused_mut)]
20        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
21        ret.mode(mode);
22        ret
23    }
24    #[cfg(feature = "ShadowRootMode")]
25    #[doc = "Change the `mode` field of this object."]
26    #[doc = ""]
27    #[doc = "*This API requires the following crate features to be activated: `ShadowRootInit`, `ShadowRootMode`*"]
28    pub fn mode(&mut self, val: ShadowRootMode) -> &mut Self {
29        use wasm_bindgen::JsValue;
30        let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("mode"), &JsValue::from(val));
31        debug_assert!(
32            r.is_ok(),
33            "setting properties should never fail on our dictionary objects"
34        );
35        let _ = r;
36        self
37    }
38}