Remove speechSynthesis

This commit is contained in:
Angelos Chalaris
2020-04-16 11:32:33 +03:00
parent 007e9394e6
commit 321970f27f
2 changed files with 0 additions and 28 deletions

View File

@ -1,23 +0,0 @@
---
title: speechSynthesis
tags: browser,intermediate
---
Performs speech synthesis (experimental).
Use `SpeechSynthesisUtterance.voice` and `window.speechSynthesis.getVoices()` to convert a message to speech.
Use `window.speechSynthesis.speak()` to play the message.
Learn more about the [SpeechSynthesisUtterance interface of the Web Speech API](https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance).
```js
const speechSynthesis = message => {
const msg = new SpeechSynthesisUtterance(message);
msg.voice = window.speechSynthesis.getVoices()[0];
window.speechSynthesis.speak(msg);
};
```
```js
speechSynthesis('Hello, World'); // // plays the message
```

View File

@ -1,5 +0,0 @@
const {speechSynthesis} = require('./_30s.js');
test('speechSynthesis is a Function', () => {
expect(speechSynthesis).toBeInstanceOf(Function);
});