Skip to content

Commit

Permalink
updated types and documentation on key event payloads
Browse files Browse the repository at this point in the history
  • Loading branch information
floodfx committed Feb 1, 2022
1 parent d04a14d commit 87561cf
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/server/socket/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,11 @@ export type PhxFormPayload = PhxEventPayload<"form", { value: string }> & PhxEve
// See https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values
// for all the string values for the key that kicked off the event
//{type: "keyup", event: "key_update", value: {key: "ArrowUp"}}
export type PhxKeyUpPayload = PhxEventPayload<"keyup", { value: { key: string } }>;
export type PhxKeyDownPayload = PhxEventPayload<"keydown", { value: { key: string } }>;
// {type: "keyup", event: "key_update", value: {key: "ArrowUp", value: ""}}
// {type: "keyup", event: "key_update", value: {key: "ArrowUp", value: "foo"}}
// NOTE: these payloads are the same for phx-window-key* events and phx-key* events
export type PhxKeyUpPayload = PhxEventPayload<"keyup", { value: { key: string, value?: string } }>;
export type PhxKeyDownPayload = PhxEventPayload<"keydown", { value: { key: string, value?: string } }>;


// export type PhxClickEvent = PhxIncomingMessage<PhxClickPayload>
Expand Down

0 comments on commit 87561cf

Please sign in to comment.