Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var cachedCalls = []
  2.  
  3. function updateCalls(calls) {
  4.     if (calls.length === 1) {
  5.         setCall(calls[0])
  6.         updateInterval = setInterval(function() { nextNews() }, 10000);
  7.     } else {
  8.         clearInterval(updateInterval)
  9.         setCall(calls.pop())       
  10.         setTimeout(updateCalls(calls),3000)
  11.     }
  12. }
  13.  
  14. function setCall(call) {
  15.     cachedCalls.append(call)
  16.     for (var call, index in cachedCalls) {
  17.         if (index > 3) {
  18.             cachedCalls.length = 4;
  19.             break;
  20.         }      
  21.  
  22.         if (index === 0) {
  23.             $('#nome' + index).html(call.nomePaciente)
  24.             $('#sala' + index).html(call.idSala)
  25.             $('#nome' + index).addClass('hurry')
  26.             $('#sala' + index).addClass('hurry')
  27.             $('#medico').html(call.nomeMedico)
  28.             $('#especialidade').html(call.especialidade)
  29.  
  30.             playAudioCall(call.nomePaciente, call.idSala)
  31.         } else {           
  32.             $('#nome' + index).removeClass('hurry')
  33.             $('#sala' + index).removeClass('hurry')
  34.         }
  35.     }
  36. }
  37.  
  38. function playAudioCall (nome, sala) {
  39.     utter.text = nome + "Sala" + sala;
  40.     utter.voice = english_voice;
  41.     window.speechSynthesis.speak(utter);
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement