-
Notifications
You must be signed in to change notification settings - Fork 22.4k
/
index.md
57 lines (37 loc) · 1.27 KB
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
---
title: "SpeechRecognition: end event"
short-title: end
slug: Web/API/SpeechRecognition/end_event
page-type: web-api-event
browser-compat: api.SpeechRecognition.end_event
---
{{APIRef("Web Speech API")}}
The **`end`** event of the [Web Speech API](/en-US/docs/Web/API/Web_Speech_API) {{domxref("SpeechRecognition")}} object is fired when the speech recognition service has disconnected.
## Syntax
Use the event name in methods like {{domxref("EventTarget.addEventListener", "addEventListener()")}}, or set an event handler property.
```js
addEventListener("end", (event) => {});
onend = (event) => {};
```
## Event type
A generic {{DOMxRef("Event")}} with no added properties.
## Examples
You can use the `end` event in an [`addEventListener`](/en-US/docs/Web/API/EventTarget/addEventListener) method:
```js
const recognition = new webkitSpeechRecognition() || new SpeechRecognition();
recognition.addEventListener("end", () => {
console.log("Speech recognition service disconnected");
});
```
Or use the `onend` event handler property:
```js
recognition.onend = () => {
console.log("Speech recognition service disconnected");
};
```
## Specifications
{{Specifications}}
## Browser compatibility
{{Compat}}
## See also
- [Web Speech API](/en-US/docs/Web/API/Web_Speech_API)