import { Socket } from "socket.io-client";
import { ServerEvent } from "./ServerEvent";

export type UpdateLobbyEvent = {
  playerNames: Array<string>;
  gameCode: string;
};

export function attachHandlerToUpdateLobbyEvent(
  socket: Socket,
  handler: (event: UpdateLobbyEvent) => void,
): void {
  socket.once(ServerEvent.LOBBY_UPDATE, handler);
}
