Skip to content

Commit

Permalink
Update ron2.js
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnSpahr committed May 29, 2024
1 parent 1ae18ba commit e858206
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ron2.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ function listen() {
} else {
//if listening already
isListening = false;
document.getElementById('talkBtn').value = "Talk to Ron!"; //change button text
document.getElementById("ronImg").src = "ron.png"; //default state
recognition.abort() //no more listening
document.getElementById('talkBtn').value = "Stopping..."; //change button text
}
}

function speak() {
if (isListening) { //only run if listening
try { //If browser supports the speech recognition feature.
try { //if browser supports the speech recognition feature
const instructions = document.getElementById("tipTxt");
const SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
const recognition = new SpeechRecognition();
Expand Down Expand Up @@ -55,6 +55,8 @@ function speak() {
} catch {
alert("Whoops! Looks like your browser isn't supported."); //only if browser badbad
};
} else {
document.getElementById('talkBtn').value = "Talk to Ron!"; //change button text
}
}

Expand Down

0 comments on commit e858206

Please sign in to comment.