UNPKG

@huluvu424242/honey-speaker

Version:

Text to Speech component wich is reading texts from DOM elements.

21 lines (20 loc) 587 B
import { Logger } from "./logger"; export class Synthese { constructor() { this.sprachSynthese = window.speechSynthesis; this.sprachSynthese.onvoiceschanged = () => { if (!this.voices || this.voices.length < 1) { this.voices = this.sprachSynthese.getVoices(); Logger.debugMessage("voices changed to: " + this.voices.join(",")); } else { Logger.debugMessage("voices alraedy initialized"); } }; Logger.debugMessage("call getVoices()"); this.sprachSynthese.getVoices(); } getVoices() { return this.voices; } }