Skip to content

Commit

Permalink
fix(lobby): fix timing on lobby start popup
Browse files Browse the repository at this point in the history
  • Loading branch information
p2r3 committed Sep 26, 2024
1 parent 1d5d6cb commit a82d96b
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions pages/live/lobby.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,21 +201,23 @@ async function lobbyEventHandler (event) {

// Handle game starting
setTimeout(function () {

showPopup("Game starting", "Everyone is ready. The game will now start.");
}, 1000);

// Hide the popup after 5 seconds
const startPopupTimeout = setTimeout(function () {
hidePopup();
}, 5000);

// Prevent other popups getting hidden by this
const oldShowPopup = showPopup;
showPopup = function (title, text, type = POPUP_INFO, hasCancel = false) {
clearTimeout(startPopupTimeout);
showPopup = oldShowPopup;
showPopup(title, text, type, hasCancel);
};
// Hide the popup after 5 seconds
const startPopupTimeout = setTimeout(function () {
hidePopup();
}, 5000);

// Prevent other popups getting hidden by this
const oldShowPopup = showPopup;
showPopup = function (title, text, type = POPUP_INFO, hasCancel = false) {
clearTimeout(startPopupTimeout);
showPopup = oldShowPopup;
showPopup(title, text, type, hasCancel);
};

}, 1000);

return;
}
Expand Down

0 comments on commit a82d96b

Please sign in to comment.