Skip to content

Commit

Permalink
adding streaming messages to footer (#1310)
Browse files Browse the repository at this point in the history
  • Loading branch information
david authored Feb 22, 2020
1 parent 9fc94ff commit bdbd89d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions static/js/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,11 @@ function uuidv4() {
});
}

function stream(msg){
function stream(msg, speak=false){
let streamer = $('#streamer');
if(streamer.text() != msg){
streamer.fadeOut(function() {
if(speak) { window.speechSynthesis.speak(new SpeechSynthesisUtterance(msg)); }
$(this).text(msg).fadeIn(1000);
});
}
Expand Down Expand Up @@ -140,11 +141,10 @@ window.onload = function checkBrowser(){
};

$(document).ready(function () {
stream('Welcome home. Go into the Agents tab to review your deployed agents.');
stream('Welcome home. Go into the Agents tab to review your deployed agents.', true);
});

window.onerror = function(error, url, line) {
let msg = 'Check your JavaScript console. '+error;
stream(msg);
window.speechSynthesis.speak(new SpeechSynthesisUtterance(msg));
stream(msg, true);
};

0 comments on commit bdbd89d

Please sign in to comment.