maxcountryman_web_sys/features/
gen_SpeechSynthesisErrorEventInit.rs1#![allow(unused_imports)]
2use super::*;
3use wasm_bindgen::prelude::*;
4#[wasm_bindgen]
5extern "C" {
6 # [wasm_bindgen (extends = :: js_sys :: Object , js_name = SpeechSynthesisErrorEventInit)]
7 #[derive(Debug, Clone, PartialEq, Eq)]
8 #[doc = "The `SpeechSynthesisErrorEventInit` dictionary."]
9 #[doc = ""]
10 #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorEventInit`*"]
11 pub type SpeechSynthesisErrorEventInit;
12}
13impl SpeechSynthesisErrorEventInit {
14 #[cfg(all(
15 feature = "SpeechSynthesisErrorCode",
16 feature = "SpeechSynthesisUtterance",
17 ))]
18 #[doc = "Construct a new `SpeechSynthesisErrorEventInit`."]
19 #[doc = ""]
20 #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorCode`, `SpeechSynthesisErrorEventInit`, `SpeechSynthesisUtterance`*"]
21 pub fn new(utterance: &SpeechSynthesisUtterance, error: SpeechSynthesisErrorCode) -> Self {
22 #[allow(unused_mut)]
23 let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
24 ret.utterance(utterance);
25 ret.error(error);
26 ret
27 }
28 #[doc = "Change the `bubbles` field of this object."]
29 #[doc = ""]
30 #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorEventInit`*"]
31 pub fn bubbles(&mut self, val: bool) -> &mut Self {
32 use wasm_bindgen::JsValue;
33 let r = ::js_sys::Reflect::set(
34 self.as_ref(),
35 &JsValue::from("bubbles"),
36 &JsValue::from(val),
37 );
38 debug_assert!(
39 r.is_ok(),
40 "setting properties should never fail on our dictionary objects"
41 );
42 let _ = r;
43 self
44 }
45 #[doc = "Change the `cancelable` field of this object."]
46 #[doc = ""]
47 #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorEventInit`*"]
48 pub fn cancelable(&mut self, val: bool) -> &mut Self {
49 use wasm_bindgen::JsValue;
50 let r = ::js_sys::Reflect::set(
51 self.as_ref(),
52 &JsValue::from("cancelable"),
53 &JsValue::from(val),
54 );
55 debug_assert!(
56 r.is_ok(),
57 "setting properties should never fail on our dictionary objects"
58 );
59 let _ = r;
60 self
61 }
62 #[doc = "Change the `composed` field of this object."]
63 #[doc = ""]
64 #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorEventInit`*"]
65 pub fn composed(&mut self, val: bool) -> &mut Self {
66 use wasm_bindgen::JsValue;
67 let r = ::js_sys::Reflect::set(
68 self.as_ref(),
69 &JsValue::from("composed"),
70 &JsValue::from(val),
71 );
72 debug_assert!(
73 r.is_ok(),
74 "setting properties should never fail on our dictionary objects"
75 );
76 let _ = r;
77 self
78 }
79 #[doc = "Change the `charIndex` field of this object."]
80 #[doc = ""]
81 #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorEventInit`*"]
82 pub fn char_index(&mut self, val: u32) -> &mut Self {
83 use wasm_bindgen::JsValue;
84 let r = ::js_sys::Reflect::set(
85 self.as_ref(),
86 &JsValue::from("charIndex"),
87 &JsValue::from(val),
88 );
89 debug_assert!(
90 r.is_ok(),
91 "setting properties should never fail on our dictionary objects"
92 );
93 let _ = r;
94 self
95 }
96 #[doc = "Change the `charLength` field of this object."]
97 #[doc = ""]
98 #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorEventInit`*"]
99 pub fn char_length(&mut self, val: Option<u32>) -> &mut Self {
100 use wasm_bindgen::JsValue;
101 let r = ::js_sys::Reflect::set(
102 self.as_ref(),
103 &JsValue::from("charLength"),
104 &JsValue::from(val),
105 );
106 debug_assert!(
107 r.is_ok(),
108 "setting properties should never fail on our dictionary objects"
109 );
110 let _ = r;
111 self
112 }
113 #[doc = "Change the `elapsedTime` field of this object."]
114 #[doc = ""]
115 #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorEventInit`*"]
116 pub fn elapsed_time(&mut self, val: f32) -> &mut Self {
117 use wasm_bindgen::JsValue;
118 let r = ::js_sys::Reflect::set(
119 self.as_ref(),
120 &JsValue::from("elapsedTime"),
121 &JsValue::from(val),
122 );
123 debug_assert!(
124 r.is_ok(),
125 "setting properties should never fail on our dictionary objects"
126 );
127 let _ = r;
128 self
129 }
130 #[doc = "Change the `name` field of this object."]
131 #[doc = ""]
132 #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorEventInit`*"]
133 pub fn name(&mut self, val: &str) -> &mut Self {
134 use wasm_bindgen::JsValue;
135 let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val));
136 debug_assert!(
137 r.is_ok(),
138 "setting properties should never fail on our dictionary objects"
139 );
140 let _ = r;
141 self
142 }
143 #[cfg(feature = "SpeechSynthesisUtterance")]
144 #[doc = "Change the `utterance` field of this object."]
145 #[doc = ""]
146 #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorEventInit`, `SpeechSynthesisUtterance`*"]
147 pub fn utterance(&mut self, val: &SpeechSynthesisUtterance) -> &mut Self {
148 use wasm_bindgen::JsValue;
149 let r = ::js_sys::Reflect::set(
150 self.as_ref(),
151 &JsValue::from("utterance"),
152 &JsValue::from(val),
153 );
154 debug_assert!(
155 r.is_ok(),
156 "setting properties should never fail on our dictionary objects"
157 );
158 let _ = r;
159 self
160 }
161 #[cfg(feature = "SpeechSynthesisErrorCode")]
162 #[doc = "Change the `error` field of this object."]
163 #[doc = ""]
164 #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorCode`, `SpeechSynthesisErrorEventInit`*"]
165 pub fn error(&mut self, val: SpeechSynthesisErrorCode) -> &mut Self {
166 use wasm_bindgen::JsValue;
167 let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("error"), &JsValue::from(val));
168 debug_assert!(
169 r.is_ok(),
170 "setting properties should never fail on our dictionary objects"
171 );
172 let _ = r;
173 self
174 }
175}