mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-12-27 18:38:37 +08:00
fixed online stats not refreshing when changing ui page
This commit is contained in:
parent
b8b8ffaa92
commit
88bdaa691b
2 changed files with 9 additions and 2 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue