/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* main.js :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: edbernar { if (points.length < 3) points += '.'; else points = ''; sentence.innerText = text + points; }, 500); timeout = setTimeout(() => { sendRequest("game", {action: 0}) }, 1500); returnButton.addEventListener('click', returnToLobby); } static dispose() { if (intervalPoints) clearInterval(intervalPoints); intervalPoints = null; if (timeout) clearTimeout(timeout); timeout = null; returnButton.removeEventListener('click', returnToLobby); } static showOpponent(username) { const returnButton = document.getElementById('returnToLobbyButton'); const sentence = document.getElementById('sentence'); if (intervalPoints) clearInterval(intervalPoints); intervalPoints = null; sentence.innerText = "Match found"; document.body.removeChild(returnButton); } } function returnToLobby() { sendRequest("game", {action: 2}); for (let i = 0; i < document.body.children.length; i++) { document.body.children[i].style.animation = "anim3 0.6s"; } setTimeout(() => { pageRenderer.changePage('lobbyPage'); }, 500); } export { WaitingGamePage };