From acf73104b5aad66821fcdf1441a0a82b76b13395 Mon Sep 17 00:00:00 2001 From: Jirawat Boonkumnerd Date: Fri, 8 Dec 2023 22:34:36 +0700 Subject: [PATCH] feat: add GamepadEventHandler type (#9861) Add GamepadEventHandler type for window.addEventListener `gamepadconnected` and `gamepaddisconnected` --- .changeset/late-crabs-lay.md | 5 +++++ packages/svelte/elements.d.ts | 7 +++++++ 2 files changed, 12 insertions(+) create mode 100644 .changeset/late-crabs-lay.md diff --git a/.changeset/late-crabs-lay.md b/.changeset/late-crabs-lay.md new file mode 100644 index 0000000000..26a2504a37 --- /dev/null +++ b/.changeset/late-crabs-lay.md @@ -0,0 +1,5 @@ +--- +'svelte': patch +--- + +feat: add `gamepadconnected` and `gamepaddisconnected` events diff --git a/packages/svelte/elements.d.ts b/packages/svelte/elements.d.ts index a456340283..09df6ddbc8 100644 --- a/packages/svelte/elements.d.ts +++ b/packages/svelte/elements.d.ts @@ -53,6 +53,7 @@ export type KeyboardEventHandler = EventHandler = EventHandler; export type TouchEventHandler = EventHandler; export type PointerEventHandler = EventHandler; +export type GamepadEventHandler = EventHandler; export type UIEventHandler = EventHandler; export type WheelEventHandler = EventHandler; export type AnimationEventHandler = EventHandler; @@ -336,6 +337,12 @@ export interface DOMAttributes { onlostpointercapture?: PointerEventHandler | undefined | null; onlostpointercapturecapture?: PointerEventHandler | undefined | null; + // Gamepad Events + 'on:gamepadconnected'?: GamepadEventHandler | undefined | null; + ongamepadconnected?: GamepadEventHandler | undefined | null; + 'on:gamepaddisconnected'?: GamepadEventHandler | undefined | null; + ongamepaddisconnected?: GamepadEventHandler | undefined | null; + // UI Events 'on:scroll'?: UIEventHandler | undefined | null; onscroll?: UIEventHandler | undefined | null;