Add some type information for events that are sent to the client.
This isn't really used for anything in particular except documentation
This commit is contained in:
parent
1063126164
commit
d204378ea5
1 changed files with 26 additions and 0 deletions
26
src/types/client_data.d.ts
vendored
Normal file
26
src/types/client_data.d.ts
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
interface response {
|
||||||
|
success: boolean;
|
||||||
|
message?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface HostInformation extends response {
|
||||||
|
// properties depend on `success` being `true`
|
||||||
|
game_code?: string;
|
||||||
|
players?: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Event is only emitted when the JoinGame event is successful, so there is no
|
||||||
|
// success indicator in this response
|
||||||
|
interface NewPlayer {
|
||||||
|
player: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface GameJoined extends response {
|
||||||
|
// properties depend on `success` being `true`
|
||||||
|
players: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface PlayerListResponse extends response {
|
||||||
|
// properties depend on `success` being `true`
|
||||||
|
players: string[]
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue