@react-hook/event
Advanced tools
Comparing version 1.2.0 to 1.2.1
{ | ||
"name": "@react-hook/event", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"homepage": "https://github.com/jaredLunde/react-hook/tree/master/packages/event#readme", | ||
@@ -5,0 +5,0 @@ "repository": "github:jaredLunde/react-hook", |
@@ -76,2 +76,3 @@ <hr> | ||
const useEvent = < | ||
// Also has Window, Document overloads | ||
T extends HTMLElement = HTMLElement, | ||
@@ -82,3 +83,4 @@ K extends keyof HTMLElementEventMap = keyof HTMLElementEventMap | ||
type: K, | ||
listener: EventListener<K> | ||
listener: EventListener<K>, | ||
cleanup?: (...args: any[]) => any | ||
) | ||
@@ -90,4 +92,4 @@ ``` | ||
| target | <code>React.RefObject<T> | T | Window | Document | null</code> | Yes | The React ref, `window`, or `document` to add the event listener to | | ||
| type | `keyof HTMLElementEventMap` | Yes | The type of event to listen for | | ||
| listener | `(this: HTMLElement, ev: HTMLElementEventMap[K]) => any` | Yes | The callback invoked when the event type fires | | ||
| type | `keyof EventMap` | Yes | The type of event to listen for | | ||
| listener | `(this: T, ev: EventMap[K]) => any` | Yes | The callback invoked when the event type fires | | ||
| cleanup | `(...args: any[]) => any` | No | This callback will be invoked when the event unmounts. This is _in addition_ to the automatic event listener cleanup that occurs. A common use case could be something like clearing a timeout. | | ||
@@ -94,0 +96,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
24563
97
0