diff options
Diffstat (limited to 'web/play/src/types.ts')
| -rw-r--r-- | web/play/src/types.ts | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/web/play/src/types.ts b/web/play/src/types.ts new file mode 100644 index 0000000..e594a0b --- /dev/null +++ b/web/play/src/types.ts | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | export type View = { | ||
| 2 | screen: "lobby" | "history" | "slots" | "roulette" | "blackjack" | "crash"; | ||
| 3 | [key: string]: any; | ||
| 4 | }; | ||
| 5 | |||
| 6 | export type Hello = { | ||
| 7 | type: "hello"; | ||
| 8 | version: string; | ||
| 9 | grace_seconds: number; | ||
| 10 | /** Signed-in user restored after a refresh, if any. */ | ||
| 11 | user?: string | null; | ||
| 12 | /** Estimated game-server Unix time in milliseconds. */ | ||
| 13 | time: number; | ||
| 14 | }; | ||
| 15 | |||
| 16 | export type Send = (command: unknown) => void; | ||
| 17 | |||
| 18 | export type Handlers = { | ||
| 19 | onHello: (hello: Hello) => void; | ||
| 20 | onView: (view: View) => void; | ||
| 21 | onNotice: (text: string) => void; | ||
| 22 | onError: (text: string) => void; | ||
| 23 | onReplaced: () => void; | ||
| 24 | onPong: () => void; | ||
| 25 | onOpen: () => void; | ||
| 26 | onClosed: (willRetry: boolean) => void; | ||
| 27 | }; | ||
