narrow Message some
This commit is contained in:
parent
6fcffc65f9
commit
00603452bf
|
|
@ -1,4 +1,4 @@
|
||||||
import type { Message } from "../shared/types"
|
import type { GameStartMessage } from "../shared/types"
|
||||||
import { GameContext, type InputState } from "../shared/game"
|
import { GameContext, type InputState } from "../shared/game"
|
||||||
import { focusInput } from "./focus"
|
import { focusInput } from "./focus"
|
||||||
import { $$ } from "./dom"
|
import { $$ } from "./dom"
|
||||||
|
|
@ -29,7 +29,7 @@ let pressed: InputState = {
|
||||||
justReleased: new Set(),
|
justReleased: new Set(),
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function handleGameStart(msg: Message) {
|
export async function handleGameStart(msg: GameStartMessage) {
|
||||||
const msgId = msg.id as string
|
const msgId = msg.id as string
|
||||||
const name = msg.data as string
|
const name = msg.data as string
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ export type Message = {
|
||||||
| SaveFileMessage
|
| SaveFileMessage
|
||||||
| SessionStartMessage
|
| SessionStartMessage
|
||||||
| SessionUpdateMessage
|
| SessionUpdateMessage
|
||||||
|
| GameStartMessage
|
||||||
|
|
||||||
export type MessageType = "error" | "input" | "output" | "commands" | "save-file"
|
export type MessageType = "error" | "input" | "output" | "commands" | "save-file"
|
||||||
| "game:start"
|
| "game:start"
|
||||||
|
|
@ -53,3 +54,8 @@ export type SessionUpdateMessage = {
|
||||||
type: "session:update"
|
type: "session:update"
|
||||||
data: Record<string, string>
|
data: Record<string, string>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type GameStartMessage = {
|
||||||
|
id: string
|
||||||
|
data: string
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user