Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@react-hook/event

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-hook/event - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

2

package.json
{
"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&lt;T&gt; &#124; T &#124; Window &#124; Document &#124; 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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc