-
Notifications
You must be signed in to change notification settings - Fork 22.4k
/
index.md
70 lines (47 loc) · 2.59 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
58
59
60
61
62
63
64
65
66
67
68
69
70
---
title: "SpeechSynthesisUtterance: resume event"
short-title: resume
slug: Web/API/SpeechSynthesisUtterance/resume_event
page-type: web-api-event
browser-compat: api.SpeechSynthesisUtterance.resume_event
---
{{APIRef("Web Speech API")}}
The **`resume`** event of the [Web Speech API](/en-US/docs/Web/API/Web_Speech_API) {{domxref("SpeechSynthesisUtterance")}} object is fired when a paused utterance is resumed.
## Syntax
Use the event name in methods like {{domxref("EventTarget.addEventListener", "addEventListener()")}}, or set an event handler property.
```js
addEventListener("resume", (event) => {});
onresume = (event) => {};
```
## Event type
A {{domxref("SpeechSynthesisEvent")}}. Inherits from {{domxref("Event")}}.
{{InheritanceDiagram("SpeechSynthesisEvent")}}
## Event properties
_In addition to the properties listed below, properties from the parent interface, {{domxref("Event")}}, are available._
- {{domxref("SpeechSynthesisEvent.charIndex", "charIndex")}} {{ReadOnlyInline}}
- : Returns the index position of the character in the {{domxref("SpeechSynthesisUtterance.text")}} that was being spoken when the event was triggered.
- {{domxref("SpeechSynthesisEvent.elapsedTime", "elapsedTime")}} {{ReadOnlyInline}}
- : Returns the elapsed time in seconds after the {{domxref("SpeechSynthesisUtterance.text")}} started being spoken that the event was triggered at.
- {{domxref("SpeechSynthesisEvent.name", "name")}} {{ReadOnlyInline}}
- : Returns the name associated with certain types of events occurring as the {{domxref("SpeechSynthesisUtterance.text")}} is being spoken: the name of the [SSML](https://www.w3.org/TR/speech-synthesis/#S3.3.2) marker reached in the case of a {{domxref("SpeechSynthesisUtterance.mark_event", "mark")}} event, or the type of boundary reached in the case of a {{domxref("SpeechSynthesisUtterance.boundary_event", "boundary")}} event.
- {{domxref("SpeechSynthesisEvent.utterance", "utterance")}} {{ReadOnlyInline}}
- : Returns the {{domxref("SpeechSynthesisUtterance")}} instance that the event was triggered on.
## Examples
You can use the `resume` event in an [`addEventListener`](/en-US/docs/Web/API/EventTarget/addEventListener) method:
```js
utterThis.addEventListener("resume", (event) => {
console.log(`Speech resumed after ${event.elapsedTime} seconds.`);
});
```
Or use the `onresume` event handler property:
```js
utterThis.onresume = (event) => {
console.log(`Speech resumed after ${event.elapsedTime} seconds.`);
};
```
## Specifications
{{Specifications}}
## Browser compatibility
{{Compat}}
## See also
- [Web Speech API](/en-US/docs/Web/API/Web_Speech_API)