diff --git a/src/js/tribe/tribe-online-stats.js b/src/js/tribe/tribe-online-stats.js index 0a5a91da3..2355c805a 100644 --- a/src/js/tribe/tribe-online-stats.js +++ b/src/js/tribe/tribe-online-stats.js @@ -1,4 +1,5 @@ import * as Tribe from "./tribe"; +import * as Notifications from "./notifications"; export let inQueueNumbers = [0, 0, 0, 0]; @@ -50,14 +51,18 @@ export function updateRaces(races) { ).text(`Rooms: ${races.private}`); } +let to = null; + export function refresh() { showLoading(); Tribe.socket.emit("mp_get_online_stats"); if ( $(".pageTribe").hasClass("active") && - !$(".pageTribe .prelobby").hasClass("hidden") + !$(".pageTribe .prelobby").hasClass("hidden") && + to == null ) { - setTimeout(() => { + to = setTimeout(() => { + to = null; refresh(); }, 15000); } diff --git a/src/js/ui.js b/src/js/ui.js index 0ae76a922..f8b95813b 100644 --- a/src/js/ui.js +++ b/src/js/ui.js @@ -15,6 +15,7 @@ import * as Settings from "./settings"; import * as Account from "./account"; import * as Leaderboards from "./leaderboards"; import * as Tribe from "./tribe"; +import * as TribeOnlineStats from "./tribe-online-stats"; export let pageTransition = false; @@ -235,6 +236,7 @@ export function changePage(page, tribe = false) { Tribe.init(); } } + TribeOnlineStats.refresh(); }, () => { TestConfig.show();