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