Now using variable to define time before result message disappears to avoid magic numbers in this case.
This commit is contained in:
parent
35a7438e83
commit
ca618d64ca
1 changed files with 4 additions and 3 deletions
|
|
@ -41,6 +41,7 @@ type CurrentGameInfo = GameUpdate & { lastState: GameUpdate['gameState'] | null
|
|||
// Route handler for the Tic-Tac-Toe page.
|
||||
// Instantiates the game logic and binds UI events.
|
||||
async function handleTTT(): Promise<RouteHandlerReturn> {
|
||||
const msgNotifTimeOut = 4 * 1000;
|
||||
const socket: Socket = getSocket();
|
||||
void socket;
|
||||
return {
|
||||
|
|
@ -134,7 +135,7 @@ async function handleTTT(): Promise<RouteHandlerReturn> {
|
|||
result_message.classList.remove("hidden");
|
||||
setTimeout(() => {
|
||||
result_message.classList.add("hidden");
|
||||
}, 3 * 1000);
|
||||
}, msgNotifTimeOut);
|
||||
}
|
||||
|
||||
if (type === 'win') {
|
||||
|
|
@ -154,13 +155,13 @@ async function handleTTT(): Promise<RouteHandlerReturn> {
|
|||
result_message.classList.remove("hidden");
|
||||
setTimeout(() => {
|
||||
result_message.classList.add("hidden");
|
||||
}, 3 * 1000);
|
||||
}, msgNotifTimeOut);
|
||||
} else {
|
||||
result_message.innerText = "You lost the game! :(";
|
||||
result_message.classList.remove("hidden");
|
||||
setTimeout(() => {
|
||||
result_message.classList.add("hidden");
|
||||
}, 3 * 1000);
|
||||
}, msgNotifTimeOut);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue