refactorizaciones
This commit is contained in:
@@ -97,11 +97,10 @@ const actualizaUsuarios = (usuario) => {
|
||||
? agregaMsgBroadcast(`${usuario.nickname} se ha conectado`)
|
||||
: agregaMsgBroadcast(`${usuario.nickname} se ha desconectado`);
|
||||
};
|
||||
const agregarPartida = (partida) =>{
|
||||
const agregarPartida = (partida) => {
|
||||
listaPartidas.agregarPartida(partida);
|
||||
listarPartidasAbiertas();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Cerrar sesión
|
||||
const cerrarSesion = (reason) => {
|
||||
@@ -115,7 +114,7 @@ function enviarMensaje(event) {
|
||||
if (event.key === 'Enter') {
|
||||
const mensaje = event.target.value.trim();
|
||||
if (mensaje != '') {
|
||||
socket.emit('chatMsg', mensaje);
|
||||
socket.emit('chatMsg', mensaje, agregaMsg);
|
||||
}
|
||||
event.target.value = '';
|
||||
}
|
||||
@@ -128,7 +127,7 @@ function crearPartida() {
|
||||
socket.on('onConnectRoom', entraSala);
|
||||
socket.on('onUserConnectRoom', actualizaUsuarios);
|
||||
socket.on('chatMsg', agregaMsg);
|
||||
socket.on('onCrearPartida',agregarPartida);
|
||||
socket.on('onCrearPartida', agregarPartida);
|
||||
socket.on('onUserDisconnectRoom', actualizaUsuarios);
|
||||
socket.on('disconnect', cerrarSesion);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user