add ready flag

This commit is contained in:
ouoertheo
2023-08-22 08:30:33 -05:00
parent 24b6261f46
commit 56fcf1cbb8
5 changed files with 80 additions and 0 deletions

View File

@ -11,6 +11,7 @@ class EdgeTtsProvider {
//########//
settings
ready = false
voices = []
separator = ' . '
audioElement = document.createElement('audio')
@ -52,10 +53,27 @@ class EdgeTtsProvider {
$('#edge_tts_rate').val(this.settings.rate || 0);
$('#edge_tts_rate_output').text(this.settings.rate || 0);
this.checkReady()
console.info("Settings loaded")
}
// Perform a simple readiness check by trying to fetch voiceIds
async checkReady(){
try {
if (!modules.includes('edge-tts')){
this.ready = false
return
}
await this.fetchTtsVoiceIds()
this.ready = true
} catch {
this.ready = false
}
}
async onApplyClick() {
return
}