Skip to content

Commit

Permalink
v1.7.9
Browse files Browse the repository at this point in the history
fixing build error
  • Loading branch information
mastashake08 committed Jan 23, 2023
1 parent 7cc1e1f commit 14dcbac
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
15 changes: 12 additions & 3 deletions SpeechKit.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default class SpeechKit {
this.recognition = new SpeechRecognition()
this.recognition.lang = language
this.grammarList = new SpeechGrammarList()
this.synth = window.speechSynthesis
this.synth = window.speechSynthesis || window.webkitspeechSynthesis
this.recognition.continuous = true;
this.recognition.interimResults = true;
this.utterance = {}
Expand Down Expand Up @@ -61,6 +61,15 @@ export default class SpeechKit {
const event = new Event('onspeechkitend');
document.dispatchEvent(event)
}

this.synth.onvoiceschanged = function() {
const v = this.getVoices()
const event = new CustomEvent('onspeechkitvoiceschanged', { detail: {
voices: v
}
});
document.dispatchEvent(event)
}
}
/**
* Start listening for speech recognition.
Expand Down Expand Up @@ -189,8 +198,8 @@ export default class SpeechKit {
* @returns {SpeechSynthesisVoice[]} Array of available Speech Synthesis Voices
*/

async getVoices () {
return await this.synth.getVoices()
getVoices () {
return this.synth.getVoices()
}

/**
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mastashake08/speech-kit",
"version": "1.7.8",
"version": "1.7.9",
"description": "Package for simplifying the Speech Recognition and Speech Utterence process.",
"main": "SpeechKit.js",
"scripts": {
Expand Down

0 comments on commit 14dcbac

Please sign in to comment.