@@ -11,15 +11,14 @@ export type CleanupFunction = () => void
11
11
export type EventHandler < E = Event > = ( event : E ) => void
12
12
13
13
/**
14
- * Attaches event listeners to the window object with automatic cleanup.
15
- * This overload provides type-safe event handling for window-specific events
16
- * with proper event map typing and automatic listener removal on scope disposal.
14
+ * Attaches an event listener to the window.
17
15
*
18
- * @param target Window object to attach listeners to.
19
- * @param event Event name(s) to listen for from WindowEventMap.
20
- * @param listener Event handler function(s) with proper window event typing.
21
- * @param options Optional event listener configuration.
22
- * @returns Function to manually remove all attached listeners.
16
+ * @param target The window object.
17
+ * @param event The event to listen for.
18
+ * @param listener The event listener.
19
+ * @param options The event listener options.
20
+ * @template E The event type.
21
+ * @returns A function to remove the event listener.
23
22
*
24
23
* @see https://0.vuetifyjs.com/composables/system/use-event-listener
25
24
*/
@@ -31,15 +30,14 @@ export function useEventListener<E extends keyof WindowEventMap> (
31
30
) : CleanupFunction
32
31
33
32
/**
34
- * Attaches event listeners to the document object with automatic cleanup.
35
- * This overload provides type-safe event handling for document-specific events
36
- * with proper event map typing and automatic listener removal on scope disposal.
33
+ * Attaches an event listener to the document.
37
34
*
38
- * @param target Document object to attach listeners to.
39
- * @param event Event name(s) to listen for from DocumentEventMap.
40
- * @param listener Event handler function(s) with proper document event typing.
41
- * @param options Optional event listener configuration.
42
- * @returns Function to manually remove all attached listeners.
35
+ * @param target The document object.
36
+ * @param event The event to listen for.
37
+ * @param listener The event listener.
38
+ * @param options The event listener options.
39
+ * @template E The event type.
40
+ * @returns A function to remove the event listener.
43
41
*
44
42
* @see https://0.vuetifyjs.com/composables/system/use-event-listener
45
43
*/
@@ -51,15 +49,14 @@ export function useEventListener<E extends keyof DocumentEventMap> (
51
49
) : CleanupFunction
52
50
53
51
/**
54
- * Attaches event listeners to HTML elements with automatic cleanup.
55
- * This overload provides type-safe event handling for HTML element events
56
- * with reactive target support and automatic listener removal on scope disposal.
52
+ * Attaches an event listener to an HTML element.
57
53
*
58
- * @param target HTML element or reactive reference to element.
59
- * @param event Event name(s) to listen for from HTMLElementEventMap.
60
- * @param listener Event handler function(s) with proper HTML element event typing.
61
- * @param options Optional event listener configuration.
62
- * @returns Function to manually remove all attached listeners.
54
+ * @param target The HTML element.
55
+ * @param event The event to listen for.
56
+ * @param listener The event listener.
57
+ * @param options The event listener options.
58
+ * @template E The event type.
59
+ * @returns A function to remove the event listener.
63
60
*
64
61
* @see https://0.vuetifyjs.com/composables/system/use-event-listener
65
62
*/
@@ -71,15 +68,14 @@ export function useEventListener<E extends keyof HTMLElementEventMap> (
71
68
) : CleanupFunction
72
69
73
70
/**
74
- * Attaches event listeners to any EventTarget with automatic cleanup.
75
- * This overload provides flexible event handling for any EventTarget implementation
76
- * with reactive target support and automatic listener removal on scope disposal.
71
+ * Attaches an event listener to an event target.
77
72
*
78
- * @param target EventTarget or reactive reference to target.
79
- * @param event Event name(s) to listen for as string identifiers.
80
- * @param listener Event handler function(s) with customizable event typing.
81
- * @param options Optional event listener configuration.
82
- * @returns Function to manually remove all attached listeners.
73
+ * @param target The event target.
74
+ * @param event The event to listen for.
75
+ * @param listener The event listener.
76
+ * @param options The event listener options.
77
+ * @template EventType The event type.
78
+ * @returns A function to remove the event listener.
83
79
*
84
80
* @see https://0.vuetifyjs.com/composables/system/use-event-listener
85
81
*/
@@ -91,13 +87,13 @@ export function useEventListener<EventType = Event> (
91
87
) : CleanupFunction
92
88
93
89
/**
94
- * Attaches event listeners to a target with automatic cleanup .
90
+ * Attaches an event listener to a target.
95
91
*
96
- * @param target EventTarget or reactive reference to target .
97
- * @param event Event name(s) to listen for as string identifiers .
98
- * @param listener Event handler function(s) with customizable event typing .
99
- * @param options Optional event listener configuration .
100
- * @returns Function to manually remove all attached listeners .
92
+ * @param target The target to attach the event listener to .
93
+ * @param event The event to listen for.
94
+ * @param listener The event listener .
95
+ * @param options The event listener options .
96
+ * @returns A function to remove the event listener .
101
97
*
102
98
* @see https://0.vuetifyjs.com/composables/system/use-event-listener
103
99
*/
@@ -155,14 +151,13 @@ export function useEventListener (
155
151
}
156
152
157
153
/**
158
- * Convenience function for attaching event listeners to the window object.
159
- * This function provides a simplified API by pre-binding the window target,
160
- * making it easier to handle window-specific events with automatic cleanup.
154
+ * Attaches an event listener to the window.
161
155
*
162
- * @param event Event name(s) to listen for from WindowEventMap.
163
- * @param listener Event handler function(s) with proper window event typing.
164
- * @param options Optional event listener configuration.
165
- * @returns Function to manually remove all attached listeners.
156
+ * @param event The event to listen for.
157
+ * @param listener The event listener.
158
+ * @param options The event listener options.
159
+ * @template E The event type.
160
+ * @returns A function to remove the event listener.
166
161
*
167
162
* @see https://0.vuetifyjs.com/composables/system/use-event-listener
168
163
*/
@@ -175,14 +170,13 @@ export function useWindowEventListener<E extends keyof WindowEventMap> (
175
170
}
176
171
177
172
/**
178
- * Convenience function for attaching event listeners to the document object.
179
- * This function provides a simplified API by pre-binding the document target,
180
- * making it easier to handle document-specific events with automatic cleanup.
173
+ * Attaches an event listener to the document.
181
174
*
182
- * @param event Event name(s) to listen for from DocumentEventMap.
183
- * @param listener Event handler function(s) with proper document event typing.
184
- * @param options Optional event listener configuration.
185
- * @returns Function to manually remove all attached listeners.
175
+ * @param event The event to listen for.
176
+ * @param listener The event listener.
177
+ * @param options The event listener options.
178
+ * @template E The event type.
179
+ * @returns A function to remove the event listener.
186
180
*
187
181
* @see https://0.vuetifyjs.com/composables/system/use-event-listener
188
182
*/
0 commit comments