maxcountryman_web_sys/features/
gen_PresentationConnectionCloseEventInit.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 = PresentationConnectionCloseEventInit)]
7    #[derive(Debug, Clone, PartialEq, Eq)]
8    #[doc = "The `PresentationConnectionCloseEventInit` dictionary."]
9    #[doc = ""]
10    #[doc = "*This API requires the following crate features to be activated: `PresentationConnectionCloseEventInit`*"]
11    pub type PresentationConnectionCloseEventInit;
12}
13impl PresentationConnectionCloseEventInit {
14    #[cfg(feature = "PresentationConnectionClosedReason")]
15    #[doc = "Construct a new `PresentationConnectionCloseEventInit`."]
16    #[doc = ""]
17    #[doc = "*This API requires the following crate features to be activated: `PresentationConnectionCloseEventInit`, `PresentationConnectionClosedReason`*"]
18    pub fn new(reason: PresentationConnectionClosedReason) -> Self {
19        #[allow(unused_mut)]
20        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
21        ret.reason(reason);
22        ret
23    }
24    #[doc = "Change the `bubbles` field of this object."]
25    #[doc = ""]
26    #[doc = "*This API requires the following crate features to be activated: `PresentationConnectionCloseEventInit`*"]
27    pub fn bubbles(&mut self, val: bool) -> &mut Self {
28        use wasm_bindgen::JsValue;
29        let r = ::js_sys::Reflect::set(
30            self.as_ref(),
31            &JsValue::from("bubbles"),
32            &JsValue::from(val),
33        );
34        debug_assert!(
35            r.is_ok(),
36            "setting properties should never fail on our dictionary objects"
37        );
38        let _ = r;
39        self
40    }
41    #[doc = "Change the `cancelable` field of this object."]
42    #[doc = ""]
43    #[doc = "*This API requires the following crate features to be activated: `PresentationConnectionCloseEventInit`*"]
44    pub fn cancelable(&mut self, val: bool) -> &mut Self {
45        use wasm_bindgen::JsValue;
46        let r = ::js_sys::Reflect::set(
47            self.as_ref(),
48            &JsValue::from("cancelable"),
49            &JsValue::from(val),
50        );
51        debug_assert!(
52            r.is_ok(),
53            "setting properties should never fail on our dictionary objects"
54        );
55        let _ = r;
56        self
57    }
58    #[doc = "Change the `composed` field of this object."]
59    #[doc = ""]
60    #[doc = "*This API requires the following crate features to be activated: `PresentationConnectionCloseEventInit`*"]
61    pub fn composed(&mut self, val: bool) -> &mut Self {
62        use wasm_bindgen::JsValue;
63        let r = ::js_sys::Reflect::set(
64            self.as_ref(),
65            &JsValue::from("composed"),
66            &JsValue::from(val),
67        );
68        debug_assert!(
69            r.is_ok(),
70            "setting properties should never fail on our dictionary objects"
71        );
72        let _ = r;
73        self
74    }
75    #[doc = "Change the `message` field of this object."]
76    #[doc = ""]
77    #[doc = "*This API requires the following crate features to be activated: `PresentationConnectionCloseEventInit`*"]
78    pub fn message(&mut self, val: &str) -> &mut Self {
79        use wasm_bindgen::JsValue;
80        let r = ::js_sys::Reflect::set(
81            self.as_ref(),
82            &JsValue::from("message"),
83            &JsValue::from(val),
84        );
85        debug_assert!(
86            r.is_ok(),
87            "setting properties should never fail on our dictionary objects"
88        );
89        let _ = r;
90        self
91    }
92    #[cfg(feature = "PresentationConnectionClosedReason")]
93    #[doc = "Change the `reason` field of this object."]
94    #[doc = ""]
95    #[doc = "*This API requires the following crate features to be activated: `PresentationConnectionCloseEventInit`, `PresentationConnectionClosedReason`*"]
96    pub fn reason(&mut self, val: PresentationConnectionClosedReason) -> &mut Self {
97        use wasm_bindgen::JsValue;
98        let r =
99            ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("reason"), &JsValue::from(val));
100        debug_assert!(
101            r.is_ok(),
102            "setting properties should never fail on our dictionary objects"
103        );
104        let _ = r;
105        self
106    }
107}