2025-01-29 23:43:33 +01:00
|
|
|
export type MessageKind = "click" | "hello" | "update" | "endgame" | "reset" | "spectate";
|
2024-09-04 14:25:37 +02:00
|
|
|
|
|
|
|
export interface Message {
|
2024-09-25 13:40:22 +02:00
|
|
|
kind: MessageKind,
|
2025-01-29 23:43:33 +01:00
|
|
|
data: Click | Update | Hello | EndGame | Reset | Spectate,
|
2024-09-04 14:25:37 +02:00
|
|
|
}
|
|
|
|
|
2025-01-24 16:19:16 +01:00
|
|
|
export interface Click {
|
2024-09-25 13:40:22 +02:00
|
|
|
x: number,
|
|
|
|
y: number
|
2024-09-04 14:25:37 +02:00
|
|
|
}
|
|
|
|
|
2025-01-29 23:43:33 +01:00
|
|
|
export type Symbol = "x" | "o";
|
|
|
|
|
2025-01-24 16:19:16 +01:00
|
|
|
export interface Update {
|
2025-01-29 23:43:33 +01:00
|
|
|
last: { x: number, y: number, symbol: Symbol }
|
2024-09-04 14:25:37 +02:00
|
|
|
}
|
|
|
|
|
2024-09-08 12:05:02 +02:00
|
|
|
export interface Hello {
|
2024-09-25 11:58:56 +02:00
|
|
|
id: number,
|
2024-09-25 13:40:22 +02:00
|
|
|
symbol: "x" | "o"
|
2024-09-08 12:05:02 +02:00
|
|
|
}
|
|
|
|
|
2024-09-09 14:09:00 +02:00
|
|
|
export interface EndGame {
|
|
|
|
issue: "win" | "lose" | "draw"
|
|
|
|
}
|
2024-09-25 22:15:10 +02:00
|
|
|
|
|
|
|
type Reset = undefined;
|
|
|
|
|
2025-01-29 23:43:33 +01:00
|
|
|
|
|
|
|
export interface Spectate {
|
|
|
|
grid: (Symbol | undefined)[]
|
|
|
|
}
|
|
|
|
|