fixed online stats not refreshing when changing ui page

This commit is contained in:
Jack 2021-04-20 01:36:48 +01:00
parent b8b8ffaa92
commit 88bdaa691b
2 changed files with 9 additions and 2 deletions

View file

@ -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);
}

View file

@ -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();