TrainsAndRoads/interface/server-events/UpdateLobbyEvent.ts

15 lines
351 B
TypeScript

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);
}