Skip to content

Instantly share code, notes, and snippets.

@rodorgas
Created March 22, 2019 04:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rodorgas/8677c4e04fd52956a858ac1df768d02c to your computer and use it in GitHub Desktop.
Save rodorgas/8677c4e04fd52956a858ac1df768d02c to your computer and use it in GitHub Desktop.
// Toca alarme quando a fila atingir os valores abaixo:
let limites = [310000, 100000, 50000, 10000, 1000];
// Define intervalo de verificação em segundos
let intervalo = 30;
function alarm() {
var audio = new Audio('https://linux.ime.usp.br/~orem/alarme.mp3');
audio.play();
}
function checkLine(limite) {
let qtd = parseInt(document.querySelector('#MainPart_lbUsersInLineAheadOfYou').innerText);
console.log(qtd);
if (qtd < limite) {
alarm();
return true;
}
else return false;
}
for (let limite of limites) {
let interval = setInterval(function () {
if (checkLine(limite)) clearInterval(interval); console.log(interval);
}, intervalo * 1000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment