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

@use-it/event-listener

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@use-it/event-listener - npm Package Compare versions

Comparing version 0.1.4 to 0.1.5

dist/event-listener.modern.js

2

dist/event-listener.js

@@ -1,1 +0,1 @@

var e=require("react");module.exports=function(r,n,t,u){void 0===t&&(t=global);var i=e.useRef();e.useEffect(function(){i.current=n},[n]);var o=u?u.capture:void 0,c=u?u.passive:void 0,v=e.useMemo(function(){return{capture:o,passive:c}},[o,c]);e.useEffect(function(){if(t&&t.addEventListener){var e=function(e){return i.current(e)};return t.addEventListener(r,e,v),function(){t.removeEventListener(r,e)}}},[r,t,v])};
var e=require("react");module.exports=function(n,r,t,u){void 0===t&&(t=global),void 0===u&&(u={});var c=e.useRef(),i=u.capture,o=u.passive,a=u.once;e.useEffect(function(){c.current=r},[r]),e.useEffect(function(){if(t&&t.addEventListener){var e=function(e){return c.current(e)},r={capture:i,passive:o,once:a};return t.addEventListener(n,e,r),function(){t.removeEventListener(n,e,r)}}},[n,t,i,o,a])};

@@ -1,1 +0,1 @@

import{useRef as e,useEffect as n,useMemo as r}from"react";export default function(t,i,o,u){void 0===o&&(o=global);var a=e();n(function(){a.current=i},[i]);var v=u?u.capture:void 0,c=u?u.passive:void 0,f=r(function(){return{capture:v,passive:c}},[v,c]);n(function(){if(o&&o.addEventListener){var e=function(e){return a.current(e)};return o.addEventListener(t,e,f),function(){o.removeEventListener(t,e)}}},[t,o,f])}
import{useRef as e,useEffect as n}from"react";export default function(t,r,i,o){void 0===i&&(i=global),void 0===o&&(o={});var c=e(),u=o.capture,a=o.passive,v=o.once;n(function(){c.current=r},[r]),n(function(){if(i&&i.addEventListener){var e=function(e){return c.current(e)},n={capture:u,passive:a,once:v};return i.addEventListener(t,e,n),function(){i.removeEventListener(t,e,n)}}},[t,i,u,a,v])}

@@ -1,1 +0,1 @@

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n(require("react")):"function"==typeof define&&define.amd?define(["react"],n):e.eventListener=n(e.react)}(this,function(e){return function(n,t,r,i){void 0===r&&(r=global);var u=e.useRef();e.useEffect(function(){u.current=t},[t]);var o=i?i.capture:void 0,f=i?i.passive:void 0,c=e.useMemo(function(){return{capture:o,passive:f}},[o,f]);e.useEffect(function(){if(r&&r.addEventListener){var e=function(e){return u.current(e)};return r.addEventListener(n,e,c),function(){r.removeEventListener(n,e)}}},[n,r,c])}});
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n(require("react")):"function"==typeof define&&define.amd?define(["react"],n):(e=e||self).eventListener=n(e.react)}(this,function(e){return function(n,t,r,i){void 0===r&&(r=global),void 0===i&&(i={});var f=e.useRef(),o=i.capture,u=i.passive,c=i.once;e.useEffect(function(){f.current=t},[t]),e.useEffect(function(){if(r&&r.addEventListener){var e=function(e){return f.current(e)},t={capture:o,passive:u,once:c};return r.addEventListener(n,e,t),function(){r.removeEventListener(n,e,t)}}},[n,r,o,u,c])}});

@@ -6,3 +6,3 @@ {

},
"version": "0.1.4",
"version": "0.1.5",
"description": "A custom React Hook that provides a useEventListener.",

@@ -39,18 +39,18 @@ "main": "dist/event-listener.js",

"devDependencies": {
"@babel/core": "^7.2.2",
"@babel/preset-env": "^7.2.3",
"@babel/preset-react": "^7.0.0",
"@testing-library/react-hooks": "^3.2.1",
"@babel/core": "^7.10.5",
"@babel/preset-env": "^7.10.4",
"@babel/preset-react": "^7.10.4",
"@testing-library/jest-dom": "^5.11.1",
"@testing-library/react-hooks": "^3.4.1",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^23.6.0",
"eslint": "^5.10.0",
"eslint-config-amex": "^9.0.0",
"jest": "^23.6.0",
"jest-dom": "^3.0.0",
"microbundle": "^0.9.0",
"babel-jest": "^26.1.0",
"eslint": "^7.5.0",
"eslint-config-amex": "^13.0.0",
"jest": "^26.1.0",
"microbundle": "^0.12.3",
"react": "^16.9.0",
"react-dom": "^16.9.0",
"react-test-renderer": "^16.13.0",
"rimraf": "^2.6.2",
"typescript": "^3.8.3"
"react-dom": "^16.13.1",
"react-test-renderer": "^16.13.1",
"rimraf": "^3.0.2",
"typescript": "^3.9.7"
},

@@ -57,0 +57,0 @@ "peerDependencies": {

@@ -116,2 +116,3 @@ # @use-it/event-listener

<td align="center"><a href="https://github.com/bvanderdrift"><img src="https://avatars1.githubusercontent.com/u/6398452?v=4" width="100px;" alt=""/><br /><sub><b>Beer van der Drift</b></sub></a><br /><a href="https://github.com/donavon/use-event-listener/commits?author=bvanderdrift" title="Tests">⚠️</a> <a href="https://github.com/donavon/use-event-listener/commits?author=bvanderdrift" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/pruge"><img src="https://avatars1.githubusercontent.com/u/5827473?v=4" width="100px;" alt=""/><br /><sub><b>clingsoft</b></sub></a><br /><a href="https://github.com/donavon/use-event-listener/commits?author=pruge" title="Code">💻</a></td>
</tr>

@@ -118,0 +119,0 @@ </table>

@@ -1,2 +0,2 @@

type Options = Pick<AddEventListenerOptions, 'capture' | 'passive'>
type Options = Pick<AddEventListenerOptions, 'capture' | 'passive' | 'once'>;

@@ -3,0 +3,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