1
0
mirror of https://gitlab.crans.org/nounous/ghostream.git synced 2025-06-27 20:22:16 +02:00

Make viewers counter period configurable

This commit is contained in:
Alexandre Iooss
2020-09-29 18:44:32 +02:00
parent 12009b5875
commit 06542590e1
5 changed files with 18 additions and 9 deletions

View File

@ -1,4 +1,5 @@
function refreshViewersCounter() {
// Refresh viewer count by pulling metric from server
function refreshViewersCounter(period) {
let xhr = new XMLHttpRequest()
xhr.open("GET", "/_stats/", true)
xhr.onload = function () {
@ -12,7 +13,7 @@ function refreshViewersCounter() {
}
xhr.send()
setTimeout(refreshViewersCounter, 20000)
setTimeout(() => {
refreshViewersCounter(period)
}, period)
}
refreshViewersCounter()