Skip to main content

web_sys/features/
gen_SpeechRecognition.rs

1#![allow(unused_imports)]
2#![allow(clippy::all)]
3use super::*;
4use wasm_bindgen::prelude::*;
5#[wasm_bindgen]
6extern "C" {
7    #[wasm_bindgen(
8        extends = "EventTarget",
9        extends = "::js_sys::Object",
10        js_name = "SpeechRecognition",
11        typescript_type = "SpeechRecognition"
12    )]
13    #[derive(Debug, Clone, PartialEq, Eq)]
14    #[doc = "The `SpeechRecognition` class."]
15    #[doc = ""]
16    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition)"]
17    #[doc = ""]
18    #[doc = "*This API requires the following crate features to be activated: `SpeechRecognition`*"]
19    pub type SpeechRecognition;
20    #[cfg(feature = "SpeechGrammarList")]
21    #[wasm_bindgen(method, getter, js_class = "SpeechRecognition", js_name = "grammars")]
22    #[doc = "Getter for the `grammars` field of this object."]
23    #[doc = ""]
24    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/grammars)"]
25    #[doc = ""]
26    #[doc = "*This API requires the following crate features to be activated: `SpeechGrammarList`, `SpeechRecognition`*"]
27    pub fn grammars(this: &SpeechRecognition) -> SpeechGrammarList;
28    #[cfg(feature = "SpeechGrammarList")]
29    #[wasm_bindgen(method, setter, js_class = "SpeechRecognition", js_name = "grammars")]
30    #[doc = "Setter for the `grammars` field of this object."]
31    #[doc = ""]
32    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/grammars)"]
33    #[doc = ""]
34    #[doc = "*This API requires the following crate features to be activated: `SpeechGrammarList`, `SpeechRecognition`*"]
35    pub fn set_grammars(this: &SpeechRecognition, value: &SpeechGrammarList);
36    #[wasm_bindgen(method, getter, js_class = "SpeechRecognition", js_name = "lang")]
37    #[doc = "Getter for the `lang` field of this object."]
38    #[doc = ""]
39    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/lang)"]
40    #[doc = ""]
41    #[doc = "*This API requires the following crate features to be activated: `SpeechRecognition`*"]
42    pub fn lang(this: &SpeechRecognition) -> ::alloc::string::String;
43    #[wasm_bindgen(method, setter, js_class = "SpeechRecognition", js_name = "lang")]
44    #[doc = "Setter for the `lang` field of this object."]
45    #[doc = ""]
46    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/lang)"]
47    #[doc = ""]
48    #[doc = "*This API requires the following crate features to be activated: `SpeechRecognition`*"]
49    pub fn set_lang(this: &SpeechRecognition, value: &str);
50    #[wasm_bindgen(
51        catch,
52        method,
53        getter,
54        js_class = "SpeechRecognition",
55        js_name = "continuous"
56    )]
57    #[doc = "Getter for the `continuous` field of this object."]
58    #[doc = ""]
59    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/continuous)"]
60    #[doc = ""]
61    #[doc = "*This API requires the following crate features to be activated: `SpeechRecognition`*"]
62    pub fn continuous(this: &SpeechRecognition) -> Result<bool, JsValue>;
63    #[wasm_bindgen(
64        catch,
65        method,
66        setter,
67        js_class = "SpeechRecognition",
68        js_name = "continuous"
69    )]
70    #[doc = "Setter for the `continuous` field of this object."]
71    #[doc = ""]
72    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/continuous)"]
73    #[doc = ""]
74    #[doc = "*This API requires the following crate features to be activated: `SpeechRecognition`*"]
75    pub fn set_continuous(this: &SpeechRecognition, value: bool) -> Result<(), JsValue>;
76    #[wasm_bindgen(
77        method,
78        getter,
79        js_class = "SpeechRecognition",
80        js_name = "interimResults"
81    )]
82    #[doc = "Getter for the `interimResults` field of this object."]
83    #[doc = ""]
84    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/interimResults)"]
85    #[doc = ""]
86    #[doc = "*This API requires the following crate features to be activated: `SpeechRecognition`*"]
87    pub fn interim_results(this: &SpeechRecognition) -> bool;
88    #[wasm_bindgen(
89        method,
90        setter,
91        js_class = "SpeechRecognition",
92        js_name = "interimResults"
93    )]
94    #[doc = "Setter for the `interimResults` field of this object."]
95    #[doc = ""]
96    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/interimResults)"]
97    #[doc = ""]
98    #[doc = "*This API requires the following crate features to be activated: `SpeechRecognition`*"]
99    pub fn set_interim_results(this: &SpeechRecognition, value: bool);
100    #[wasm_bindgen(
101        method,
102        getter,
103        js_class = "SpeechRecognition",
104        js_name = "maxAlternatives"
105    )]
106    #[doc = "Getter for the `maxAlternatives` field of this object."]
107    #[doc = ""]
108    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/maxAlternatives)"]
109    #[doc = ""]
110    #[doc = "*This API requires the following crate features to be activated: `SpeechRecognition`*"]
111    pub fn max_alternatives(this: &SpeechRecognition) -> u32;
112    #[wasm_bindgen(
113        method,
114        setter,
115        js_class = "SpeechRecognition",
116        js_name = "maxAlternatives"
117    )]
118    #[doc = "Setter for the `maxAlternatives` field of this object."]
119    #[doc = ""]
120    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/maxAlternatives)"]
121    #[doc = ""]
122    #[doc = "*This API requires the following crate features to be activated: `SpeechRecognition`*"]
123    pub fn set_max_alternatives(this: &SpeechRecognition, value: u32);
124    #[wasm_bindgen(
125        catch,
126        method,
127        getter,
128        js_class = "SpeechRecognition",
129        js_name = "serviceURI"
130    )]
131    #[doc = "Getter for the `serviceURI` field of this object."]
132    #[doc = ""]
133    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/serviceURI)"]
134    #[doc = ""]
135    #[doc = "*This API requires the following crate features to be activated: `SpeechRecognition`*"]
136    pub fn service_uri(this: &SpeechRecognition) -> Result<::alloc::string::String, JsValue>;
137    #[wasm_bindgen(
138        catch,
139        method,
140        setter,
141        js_class = "SpeechRecognition",
142        js_name = "serviceURI"
143    )]
144    #[doc = "Setter for the `serviceURI` field of this object."]
145    #[doc = ""]
146    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/serviceURI)"]
147    #[doc = ""]
148    #[doc = "*This API requires the following crate features to be activated: `SpeechRecognition`*"]
149    pub fn set_service_uri(this: &SpeechRecognition, value: &str) -> Result<(), JsValue>;
150    #[wasm_bindgen(
151        method,
152        getter,
153        js_class = "SpeechRecognition",
154        js_name = "onaudiostart"
155    )]
156    #[doc = "Getter for the `onaudiostart` field of this object."]
157    #[doc = ""]
158    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/onaudiostart)"]
159    #[doc = ""]
160    #[doc = "*This API requires the following crate features to be activated: `SpeechRecognition`*"]
161    pub fn onaudiostart(this: &SpeechRecognition) -> Option<::js_sys::Function>;
162    #[wasm_bindgen(
163        method,
164        setter,
165        js_class = "SpeechRecognition",
166        js_name = "onaudiostart"
167    )]
168    #[doc = "Setter for the `onaudiostart` field of this object."]
169    #[doc = ""]
170    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/onaudiostart)"]
171    #[doc = ""]
172    #[doc = "*This API requires the following crate features to be activated: `SpeechRecognition`*"]
173    pub fn set_onaudiostart(this: &SpeechRecognition, value: Option<&::js_sys::Function>);
174    #[wasm_bindgen(
175        method,
176        getter,
177        js_class = "SpeechRecognition",
178        js_name = "onsoundstart"
179    )]
180    #[doc = "Getter for the `onsoundstart` field of this object."]
181    #[doc = ""]
182    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/onsoundstart)"]
183    #[doc = ""]
184    #[doc = "*This API requires the following crate features to be activated: `SpeechRecognition`*"]
185    pub fn onsoundstart(this: &SpeechRecognition) -> Option<::js_sys::Function>;
186    #[wasm_bindgen(
187        method,
188        setter,
189        js_class = "SpeechRecognition",
190        js_name = "onsoundstart"
191    )]
192    #[doc = "Setter for the `onsoundstart` field of this object."]
193    #[doc = ""]
194    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/onsoundstart)"]
195    #[doc = ""]
196    #[doc = "*This API requires the following crate features to be activated: `SpeechRecognition`*"]
197    pub fn set_onsoundstart(this: &SpeechRecognition, value: Option<&::js_sys::Function>);
198    #[wasm_bindgen(
199        method,
200        getter,
201        js_class = "SpeechRecognition",
202        js_name = "onspeechstart"
203    )]
204    #[doc = "Getter for the `onspeechstart` field of this object."]
205    #[doc = ""]
206    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/onspeechstart)"]
207    #[doc = ""]
208    #[doc = "*This API requires the following crate features to be activated: `SpeechRecognition`*"]
209    pub fn onspeechstart(this: &SpeechRecognition) -> Option<::js_sys::Function>;
210    #[wasm_bindgen(
211        method,
212        setter,
213        js_class = "SpeechRecognition",
214        js_name = "onspeechstart"
215    )]
216    #[doc = "Setter for the `onspeechstart` field of this object."]
217    #[doc = ""]
218    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/onspeechstart)"]
219    #[doc = ""]
220    #[doc = "*This API requires the following crate features to be activated: `SpeechRecognition`*"]
221    pub fn set_onspeechstart(this: &SpeechRecognition, value: Option<&::js_sys::Function>);
222    #[wasm_bindgen(
223        method,
224        getter,
225        js_class = "SpeechRecognition",
226        js_name = "onspeechend"
227    )]
228    #[doc = "Getter for the `onspeechend` field of this object."]
229    #[doc = ""]
230    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/onspeechend)"]
231    #[doc = ""]
232    #[doc = "*This API requires the following crate features to be activated: `SpeechRecognition`*"]
233    pub fn onspeechend(this: &SpeechRecognition) -> Option<::js_sys::Function>;
234    #[wasm_bindgen(
235        method,
236        setter,
237        js_class = "SpeechRecognition",
238        js_name = "onspeechend"
239    )]
240    #[doc = "Setter for the `onspeechend` field of this object."]
241    #[doc = ""]
242    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/onspeechend)"]
243    #[doc = ""]
244    #[doc = "*This API requires the following crate features to be activated: `SpeechRecognition`*"]
245    pub fn set_onspeechend(this: &SpeechRecognition, value: Option<&::js_sys::Function>);
246    #[wasm_bindgen(method, getter, js_class = "SpeechRecognition", js_name = "onsoundend")]
247    #[doc = "Getter for the `onsoundend` field of this object."]
248    #[doc = ""]
249    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/onsoundend)"]
250    #[doc = ""]
251    #[doc = "*This API requires the following crate features to be activated: `SpeechRecognition`*"]
252    pub fn onsoundend(this: &SpeechRecognition) -> Option<::js_sys::Function>;
253    #[wasm_bindgen(method, setter, js_class = "SpeechRecognition", js_name = "onsoundend")]
254    #[doc = "Setter for the `onsoundend` field of this object."]
255    #[doc = ""]
256    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/onsoundend)"]
257    #[doc = ""]
258    #[doc = "*This API requires the following crate features to be activated: `SpeechRecognition`*"]
259    pub fn set_onsoundend(this: &SpeechRecognition, value: Option<&::js_sys::Function>);
260    #[wasm_bindgen(method, getter, js_class = "SpeechRecognition", js_name = "onaudioend")]
261    #[doc = "Getter for the `onaudioend` field of this object."]
262    #[doc = ""]
263    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/onaudioend)"]
264    #[doc = ""]
265    #[doc = "*This API requires the following crate features to be activated: `SpeechRecognition`*"]
266    pub fn onaudioend(this: &SpeechRecognition) -> Option<::js_sys::Function>;
267    #[wasm_bindgen(method, setter, js_class = "SpeechRecognition", js_name = "onaudioend")]
268    #[doc = "Setter for the `onaudioend` field of this object."]
269    #[doc = ""]
270    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/onaudioend)"]
271    #[doc = ""]
272    #[doc = "*This API requires the following crate features to be activated: `SpeechRecognition`*"]
273    pub fn set_onaudioend(this: &SpeechRecognition, value: Option<&::js_sys::Function>);
274    #[wasm_bindgen(method, getter, js_class = "SpeechRecognition", js_name = "onresult")]
275    #[doc = "Getter for the `onresult` field of this object."]
276    #[doc = ""]
277    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/onresult)"]
278    #[doc = ""]
279    #[doc = "*This API requires the following crate features to be activated: `SpeechRecognition`*"]
280    pub fn onresult(this: &SpeechRecognition) -> Option<::js_sys::Function>;
281    #[wasm_bindgen(method, setter, js_class = "SpeechRecognition", js_name = "onresult")]
282    #[doc = "Setter for the `onresult` field of this object."]
283    #[doc = ""]
284    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/onresult)"]
285    #[doc = ""]
286    #[doc = "*This API requires the following crate features to be activated: `SpeechRecognition`*"]
287    pub fn set_onresult(this: &SpeechRecognition, value: Option<&::js_sys::Function>);
288    #[wasm_bindgen(method, getter, js_class = "SpeechRecognition", js_name = "onnomatch")]
289    #[doc = "Getter for the `onnomatch` field of this object."]
290    #[doc = ""]
291    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/onnomatch)"]
292    #[doc = ""]
293    #[doc = "*This API requires the following crate features to be activated: `SpeechRecognition`*"]
294    pub fn onnomatch(this: &SpeechRecognition) -> Option<::js_sys::Function>;
295    #[wasm_bindgen(method, setter, js_class = "SpeechRecognition", js_name = "onnomatch")]
296    #[doc = "Setter for the `onnomatch` field of this object."]
297    #[doc = ""]
298    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/onnomatch)"]
299    #[doc = ""]
300    #[doc = "*This API requires the following crate features to be activated: `SpeechRecognition`*"]
301    pub fn set_onnomatch(this: &SpeechRecognition, value: Option<&::js_sys::Function>);
302    #[wasm_bindgen(method, getter, js_class = "SpeechRecognition", js_name = "onerror")]
303    #[doc = "Getter for the `onerror` field of this object."]
304    #[doc = ""]
305    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/onerror)"]
306    #[doc = ""]
307    #[doc = "*This API requires the following crate features to be activated: `SpeechRecognition`*"]
308    pub fn onerror(this: &SpeechRecognition) -> Option<::js_sys::Function>;
309    #[wasm_bindgen(method, setter, js_class = "SpeechRecognition", js_name = "onerror")]
310    #[doc = "Setter for the `onerror` field of this object."]
311    #[doc = ""]
312    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/onerror)"]
313    #[doc = ""]
314    #[doc = "*This API requires the following crate features to be activated: `SpeechRecognition`*"]
315    pub fn set_onerror(this: &SpeechRecognition, value: Option<&::js_sys::Function>);
316    #[wasm_bindgen(method, getter, js_class = "SpeechRecognition", js_name = "onstart")]
317    #[doc = "Getter for the `onstart` field of this object."]
318    #[doc = ""]
319    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/onstart)"]
320    #[doc = ""]
321    #[doc = "*This API requires the following crate features to be activated: `SpeechRecognition`*"]
322    pub fn onstart(this: &SpeechRecognition) -> Option<::js_sys::Function>;
323    #[wasm_bindgen(method, setter, js_class = "SpeechRecognition", js_name = "onstart")]
324    #[doc = "Setter for the `onstart` field of this object."]
325    #[doc = ""]
326    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/onstart)"]
327    #[doc = ""]
328    #[doc = "*This API requires the following crate features to be activated: `SpeechRecognition`*"]
329    pub fn set_onstart(this: &SpeechRecognition, value: Option<&::js_sys::Function>);
330    #[wasm_bindgen(method, getter, js_class = "SpeechRecognition", js_name = "onend")]
331    #[doc = "Getter for the `onend` field of this object."]
332    #[doc = ""]
333    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/onend)"]
334    #[doc = ""]
335    #[doc = "*This API requires the following crate features to be activated: `SpeechRecognition`*"]
336    pub fn onend(this: &SpeechRecognition) -> Option<::js_sys::Function>;
337    #[wasm_bindgen(method, setter, js_class = "SpeechRecognition", js_name = "onend")]
338    #[doc = "Setter for the `onend` field of this object."]
339    #[doc = ""]
340    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/onend)"]
341    #[doc = ""]
342    #[doc = "*This API requires the following crate features to be activated: `SpeechRecognition`*"]
343    pub fn set_onend(this: &SpeechRecognition, value: Option<&::js_sys::Function>);
344    #[wasm_bindgen(catch, constructor, js_class = "SpeechRecognition")]
345    #[doc = "The `new SpeechRecognition(..)` constructor, creating a new instance of `SpeechRecognition`."]
346    #[doc = ""]
347    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/SpeechRecognition)"]
348    #[doc = ""]
349    #[doc = "*This API requires the following crate features to be activated: `SpeechRecognition`*"]
350    pub fn new() -> Result<SpeechRecognition, JsValue>;
351    #[wasm_bindgen(method, js_class = "SpeechRecognition")]
352    #[doc = "The `abort()` method."]
353    #[doc = ""]
354    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/abort)"]
355    #[doc = ""]
356    #[doc = "*This API requires the following crate features to be activated: `SpeechRecognition`*"]
357    pub fn abort(this: &SpeechRecognition);
358    #[wasm_bindgen(catch, method, js_class = "SpeechRecognition")]
359    #[doc = "The `start()` method."]
360    #[doc = ""]
361    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/start)"]
362    #[doc = ""]
363    #[doc = "*This API requires the following crate features to be activated: `SpeechRecognition`*"]
364    pub fn start(this: &SpeechRecognition) -> Result<(), JsValue>;
365    #[cfg(feature = "MediaStream")]
366    #[wasm_bindgen(catch, method, js_class = "SpeechRecognition", js_name = "start")]
367    #[doc = "The `start()` method."]
368    #[doc = ""]
369    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/start)"]
370    #[doc = ""]
371    #[doc = "*This API requires the following crate features to be activated: `MediaStream`, `SpeechRecognition`*"]
372    pub fn start_with_stream(this: &SpeechRecognition, stream: &MediaStream)
373        -> Result<(), JsValue>;
374    #[wasm_bindgen(method, js_class = "SpeechRecognition")]
375    #[doc = "The `stop()` method."]
376    #[doc = ""]
377    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/stop)"]
378    #[doc = ""]
379    #[doc = "*This API requires the following crate features to be activated: `SpeechRecognition`*"]
380    pub fn stop(this: &SpeechRecognition);
381}