Auslagern von Funktionen
This commit is contained in:
@@ -6,14 +6,9 @@ class ServerConnectionManager {
|
||||
this.body = document.getElementsByTagName("body")[0];
|
||||
|
||||
// Socket.on Handler und Routen
|
||||
this.socket.on("waitingForPlayers", (msg) => {
|
||||
const { msg: message, waitingSeconds } = msg;
|
||||
document.getElementById("wM").innerText = message;
|
||||
document.getElementById("wS").innerText = waitingSeconds;
|
||||
});
|
||||
|
||||
this.socket.on("gameEnd", (msg) => { this.gameEnd(msg) });
|
||||
this.socket.on("startGame", () => { this.startGame() });
|
||||
this.socket.on("waitingForPlayers", (data) => { this.waitingForPlayers(data) });
|
||||
this.socket.on("gameEnd", (msg) => { this.gameEnd(msg) });
|
||||
|
||||
this.basicSetup();
|
||||
}
|
||||
@@ -22,6 +17,11 @@ class ServerConnectionManager {
|
||||
this.body.innerHTML = "<h1>Spielfeld</h1>";
|
||||
}
|
||||
|
||||
waitingForPlayers(data){
|
||||
document.getElementById("wM").innerText = data.msg;
|
||||
document.getElementById("wS").innerText = data.waitingSeconds;
|
||||
}
|
||||
|
||||
gameEnd(msg){
|
||||
this.socket.disconnect();
|
||||
confirm(msg)
|
||||
|
||||
Reference in New Issue
Block a user