{"_id":"@use-it/event-listener","_rev":"13-c2ce78713cf267a430f1b779d3e3ae69","name":"@use-it/event-listener","dist-tags":{"latest":"0.1.7","next":"1.0.0-beta.3"},"versions":{"0.0.0":{"name":"@use-it/event-listener","private":false,"publishConfig":{"access":"public"},"version":"0.0.0","description":"","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"author":"","license":"MIT","_id":"@use-it/event-listener@0.0.0","_nodeVersion":"10.15.0","_npmVersion":"6.7.0","dist":{"integrity":"sha512-1L9cLRM+HyM5k3Im2HPyfkHRXxqCo4h7vHP1YmkkJWdVMBgFXaHdQNMsEum+l0iWSw/maN+E3MSFyIs+PtKg5A==","shasum":"75b3777ebc3cf04ff611ab47569b20106a5d7dd8","tarball":"https://registry.npmjs.org/@use-it/event-listener/-/event-listener-0.0.0.tgz","fileCount":1,"unpackedSize":288,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcYLwWCRA9TVsSAnZWagAA1iAP/jM2GVWfy+C7wvae4b5y\nKLZ1UfG3GR9wm5kJejiCCiP8twmKB43K8p6ipt6Hxk6xVuIPIOa2JdLg1MZY\ntPiZxTU26qp3mZVYszTeiBDEzdQ95d2PYlOtncZAu0xcYeXX5TZVWLweXJDq\n1Nqm7UVAT6Y4EW9PetVu22xbf9J082q+ti++hQ1CIl+vp3uwvImd4jADww49\nRAys7UwPkbMmutZlj7V3qk6AEzuF3X2f7xcLoeutrgc2rAz4U/GG0wtDFcC6\nvrkUcLhqh+fgSgVGiLDQVzuXHcEVXDWBdKtRqfIW3IDFU0lasC0ksIYlvtxA\ntH9T8wSUbEgu85hhPqN/B4q4/h4RN5s0q4pPq6zWmCEEi5U7TYktUyKBuiJ+\nXF/jHRONnJY3cMGJod7bLYiRYW8jIF6f2OyTLEDF1gM4cafY+k84X9E7oFgz\nm2g8a5+8cBLufYRIxGifohVt5c0pb9lEsk3En4j2uEgSpFAGjFT7QL+2dNE4\n1DZwQjzW/bs/Rb4SfwYPTRgAQHpK4XZkM8PSPWG86nkzTg0/i6hSzPwDMERG\nFB/S3Wb6JDKLojV0XvdFbBgXdrfsFbZh/dmOUI3Ae91lfrad/mztetix3qOc\ncvVT4qVm6ia32vg5tcwm9dmL9042cG/ksdHqah885YeL8L4/mqqJ48kpKwye\nP3vI\r\n=10Lc\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCcxjKLJCoQ2w9hm4bzFyyp5JMHVSsa7ObSgAMFo4epgAIhAPAXbE3K18y6vk3mLnCxu1DezFnskM9vZG7ez/+VOC1x"}]},"maintainers":[{"name":"donavon","email":"github@donavon.com"}],"_npmUser":{"name":"donavon","email":"github@donavon.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/event-listener_0.0.0_1549843477591_0.3399093375311071"},"_hasShrinkwrap":false},"0.1.0":{"name":"@use-it/event-listener","publishConfig":{"access":"public"},"version":"0.1.0","description":"A custom React Hook thst provides a useEventListener.","main":"dist/use-event-listener.js","umd:main":"dist/use-event-listener.umd.js","module":"dist/use-event-listener.m.js","source":"src/index.js","license":"MIT","repository":{"type":"git","url":"git+https://github.com/donavon/use-event-listener.git"},"scripts":{"prepublishOnly":"npm run build","lint":"eslint src","test":"jest --verbose --coverage --silent","test:watch":"jest --watch --runInBand --silent","prebuild":"npm run lint && npm t && rimraf dist","build":"microbundle -o dist/ --sourcemap false --target web","dev":"microbundle watch -o dist/ --sourcemap false --compress false"},"keywords":["react-hooks","hooks","react","utils","lib","event-listener"],"author":{"name":"donavon"},"devDependencies":{"@babel/core":"^7.2.2","@babel/preset-env":"^7.2.3","@babel/preset-react":"^7.0.0","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","react":"^16.8.0","react-dom":"^16.8.0","react-testing-library":"^5.5.0","rimraf":"^2.6.2"},"peerDependencies":{"react":"^16.8.0"},"jest":{"coverageThreshold":{"global":{"branches":0,"functions":0,"lines":0,"statements":0}}},"bugs":{"url":"https://github.com/donavon/use-event-listener/issues"},"homepage":"https://github.com/donavon/use-event-listener#readme","_id":"@use-it/event-listener@0.1.0","_nodeVersion":"10.15.0","_npmVersion":"6.7.0","dist":{"integrity":"sha512-fnG9j7L2YevvbBUQpLs22gLYIWraEA+H/vNuP4kfj9XuBLXAwTqP5eN8ApnvfTCjLpMc/4H2lyGUhSD920+LsQ==","shasum":"449da334cf4255d2f53b0d7c1dd929ca9f4747b4","tarball":"https://registry.npmjs.org/@use-it/event-listener/-/event-listener-0.1.0.tgz","fileCount":6,"unpackedSize":5502,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcYO8SCRA9TVsSAnZWagAAgpcP/0WSoa2qFA1tj/NN/aMB\nTT4g6nXRKVz3sIpwYE4jWhdRex3It/GoNeAK8KArpVj3ej39CLWvHBmH2hPI\nLpqx6NF91qRmDcDMTAkdxADrLZvQskrU7Eu5eiW3tE4w3OFKVgaJDSbqSjys\n//Vp+mpVmcWy+F7RNsZRRHVqqGhuVl82yShi/TyrgGokax+zOb+K+NUU5zTI\nFjWpF39YAY+9MmbU2MFLZt9gEldhgDqm+Rq46izl3AeUzJoATdThlD9KHZYZ\n+notSkjtmxBoAUxrAmKTBx/qQXLMTAy8mfQxqRKfThq5Xp75H8NRJAVfuMIE\n/t9XKmF1406twyTx+hsb8PHxkFaAbwAEwFZ7raP8DbZ/OJGs6Il1cplyGeZ8\nHQiOvxLRH48HJPcUlcjgQJ+bOBnlhLZHlb1iJZo4rfISAu0ao5YRutNmAjfT\nRQQahjDX1b9++kMO8/h0QbU7oj+by7J9YhwdpRHVsO3+w4X911vvlD+M6HXk\nJYFs1Sje5GSyN38FizAOANTbrel5nbKHFilFr4YFYX5Y7bP/fPanjiMPKjLK\nS4pkk1DrEoVPpSXz5rjhxCMhAY0P3/V/0Bv9u+lsUStWJ71zV0oPPmBNE3Cl\nm41tU4s5aQVtIQuCDRHt0NKsjGI+4JNF8mQJoXtxwsnPT+JWfrNLsmZSD26n\nlReF\r\n=0L/n\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFqFKt+gjWCdsmUVln2YZc4m5RpZd2mZ9cZRiFMtJUofAiEA8PceIJjP0CL0MJvT6dXslu0bv/r+xR4lrnhpcHte7pc="}]},"maintainers":[{"name":"donavon","email":"github@donavon.com"}],"_npmUser":{"name":"donavon","email":"github@donavon.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/event-listener_0.1.0_1549856529551_0.6871601844746802"},"_hasShrinkwrap":false},"0.1.1":{"name":"@use-it/event-listener","publishConfig":{"access":"public"},"version":"0.1.1","description":"A custom React Hook thst provides a useEventListener.","main":"dist/event-listener.js","umd:main":"dist/event-listener.umd.js","module":"dist/event-listener.m.js","source":"src/index.js","license":"MIT","repository":{"type":"git","url":"git+https://github.com/donavon/event-listener.git"},"scripts":{"prepublishOnly":"npm run build","lint":"eslint src","test":"jest --verbose --coverage --silent","test:watch":"jest --watch --runInBand --silent","prebuild":"npm run lint && npm t && rimraf dist","build":"microbundle -o dist/ --sourcemap false --target web","dev":"microbundle watch -o dist/ --sourcemap false --compress false"},"keywords":["react-hooks","hooks","react","utils","lib","event-listener"],"author":{"name":"donavon"},"devDependencies":{"@babel/core":"^7.2.2","@babel/preset-env":"^7.2.3","@babel/preset-react":"^7.0.0","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","react":"^16.8.0","react-dom":"^16.8.0","react-testing-library":"^5.5.0","rimraf":"^2.6.2"},"peerDependencies":{"react":"^16.8.0"},"jest":{"coverageThreshold":{"global":{"branches":0,"functions":0,"lines":0,"statements":0}}},"bugs":{"url":"https://github.com/donavon/event-listener/issues"},"homepage":"https://github.com/donavon/event-listener#readme","_id":"@use-it/event-listener@0.1.1","_nodeVersion":"10.15.0","_npmVersion":"6.7.0","dist":{"integrity":"sha512-4KEzj+fsKFUlAYs2qnrsx1+2dJsnJLZq6JRzfFsO1kYuYL1DTvP9hWZ4ZcFmb2elt2QnKU/9vc0yCdE51CFFkw==","shasum":"08c9baafa9a62be7d23058c002810bd3fda4b4e1","tarball":"https://registry.npmjs.org/@use-it/event-listener/-/event-listener-0.1.1.tgz","fileCount":6,"unpackedSize":5486,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcYPPiCRA9TVsSAnZWagAAWKkQAI+nb6qzSxidDfSsWcNJ\nsnD24jskUNLnflXnIMxsxYsWfHA/bzRhAMGg3XbpxBFPyje4ogh019OUwbsK\nK6WyMqZxktDS+qHat3+U62pPa10zGfsyolAgEOyK0shJDK98WKmuJ+PslWAx\nUcRCkK/6rbAv1UcP2GgtT/rg71halZsH+5W1Si6miumdKEfFSslXjHZAMbNg\np7i61fhgL47AWogAa0Mwhjc8tkao3/jWO9wR/0Je+riwHa/S6FGjNxjp1yBy\nbhmXgsykUacEmXf9n4541LmhTeQrrScLtrTrEuuIdgoEPW5WjBBu5mcH5kHZ\nX6NcBzXgsO1GxPeONYxr875IFBe30O5LwdJWyRPzspoqrrcPZDAJcO+CzJ+B\nZ+l5+lzjsVGOLqzXaZJ+uv1uGMaPWgE+hZx+onTfAz32RSL+e7XTE154bKXY\nBl9xImLLnQJBMbRdpLsEh93lZQcLYavEfOvMIUvLHySnaSnYA3YJDnw5RZbi\ndLwypLOMsc0uruREWX/cxsI7CAFSIWOpE/RmRO/3QPbtBeJsLJ10QSmv8qoq\ntIQhIx3M3XReopZNqheFA3C08KW6gKovPg0is2drcFyltqBfEzim5Nzw7x6r\n9c0DVtibjFX1BJITvcX3erUKOuFswHq/dX+rqDMOfLV+WyNEzoZP+G7B/5JA\nGcdF\r\n=9LJv\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDWIh3hiMu/4nlu0hufkbLEupGLUr8enVv+0cXI+lLb5wIhAPDbQSepkSTuqOZIlQ/6HtMUOZXM/yFiVC92xeAbXLBS"}]},"maintainers":[{"name":"donavon","email":"github@donavon.com"}],"_npmUser":{"name":"donavon","email":"github@donavon.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/event-listener_0.1.1_1549857761791_0.19435682758344086"},"_hasShrinkwrap":false},"0.1.2":{"name":"@use-it/event-listener","publishConfig":{"access":"public"},"version":"0.1.2","description":"A custom React Hook that provides a useEventListener.","main":"dist/event-listener.js","umd:main":"dist/event-listener.umd.js","module":"dist/event-listener.m.js","source":"src/index.js","license":"MIT","repository":{"type":"git","url":"git+https://github.com/donavon/use-event-listener.git"},"scripts":{"prepublishOnly":"npm run build","lint":"eslint src","test":"jest --verbose --coverage --silent","test:watch":"jest --watch --runInBand --silent","prebuild":"npm run lint && npm t && rimraf dist","build":"microbundle -o dist/ --sourcemap false --target web","dev":"microbundle watch -o dist/ --sourcemap false --compress false"},"keywords":["react-hooks","hooks","react","utils","lib","event-listener"],"author":{"name":"donavon"},"devDependencies":{"@babel/core":"^7.2.2","@babel/preset-env":"^7.2.3","@babel/preset-react":"^7.0.0","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","react":"^16.8.0","react-dom":"^16.8.0","react-testing-library":"^5.5.0","rimraf":"^2.6.2"},"peerDependencies":{"react":"^16.8.0"},"jest":{"coverageThreshold":{"global":{"branches":100,"functions":100,"lines":100,"statements":100}}},"gitHead":"9aff43124c8117738f20051e5b46ab7ab7bb6ef8","bugs":{"url":"https://github.com/donavon/use-event-listener/issues"},"homepage":"https://github.com/donavon/use-event-listener#readme","_id":"@use-it/event-listener@0.1.2","_npmVersion":"6.5.0","_nodeVersion":"11.9.0","_npmUser":{"name":"donavon","email":"github@donavon.com"},"dist":{"integrity":"sha512-SWNrncwto6JKE7b+I+MI07bf1GYSKFOhVNAiu7/uVMRqfnjcMty7YtUnk7nS3+lD3m/5YpyIn0NalcV5ODWxEQ==","shasum":"709ae43c97bcb891ca072c9e653f26d39940f4d2","tarball":"https://registry.npmjs.org/@use-it/event-listener/-/event-listener-0.1.2.tgz","fileCount":6,"unpackedSize":8028,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcYbuTCRA9TVsSAnZWagAA83kQAImKOfBc0se95wI0LCJS\ny3BvsBBeo3tDJx2iscWPq9XuT8ve+VMv6QJSuGoUZdnM71Sn2wuifz7n2K60\nH1XFYqGCwJqrLaDAl/vSjrO1FCPnQp6J3HppfqYQe2+c7vA43CWNxDkcZjtD\njfFKFUy3zFOt1bzbYmcH+CPW03Q2KqckOyCk/yxNQYrq7U5DfOb1tJUZNhFv\n0GLJnUcpkGOkt9/MLmRnozQaooK0qs+iXw62NuE1NnU2iX4Evw/PbVANajJy\nQ7DhbBE4LjxkK1np1NS0ljDeh5MBvDjDlmbcNi0MCvZUmyA0MPh/2EdUzYQY\n/wC37/pn9fRpNyNHe2cXUJZxepKxDQGmxc+rYtloBh2+KO/3Jm59jnGykOqv\nePy7+jrCohyp5qIaRnF94BEcIaDwIy8iqvCM5If8G2YLcwppF7AYNG09P1NE\nBM7mM+e0DmLXEayc34ReyfU8RHVwc2TCIV+CVFVPpUFlk24HgxRL9j1/hbmv\n0tR/Q9z0bZ40qI1LaB1khiBw+Wj26kotvKcVWfw5m48NXJsupxp1Ju4J7UoB\nioQTM/YS1FLk5+EhmAU0fQdMfs2WYlhHwIyrnE0BfZN++jfuCQgwzObyrA9Q\nrpHdhgVeE099NAvDTYT0LIh9NUNE1Rq8hMnE6neWT06fOsemEzSqY79mAvE8\ndcTI\r\n=taob\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIG1esENChx+GVnZQtjuqUhxUW9AOY0GlQNlRQPLnt/M6AiEAoe4sI7Jsn5kr7G5LX+wiOBlnR4aaSdhGm/qMCleRILE="}]},"maintainers":[{"name":"donavon","email":"github@donavon.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/event-listener_0.1.2_1549908883403_0.11382213511497219"},"_hasShrinkwrap":false},"0.1.3":{"name":"@use-it/event-listener","publishConfig":{"access":"public"},"version":"0.1.3","description":"A custom React Hook that provides a useEventListener.","main":"dist/event-listener.js","umd:main":"dist/event-listener.umd.js","module":"dist/event-listener.m.js","source":"src/index.js","types":"types/index.d.ts","license":"MIT","repository":{"type":"git","url":"git+https://github.com/donavon/use-event-listener.git"},"scripts":{"prepublishOnly":"npm run build","lint":"eslint src","test":"jest --verbose --coverage --silent","test:watch":"jest --watch --runInBand --silent","prebuild":"npm run lint && npm t && rimraf dist","build":"microbundle -o dist/ --sourcemap false --target web","dev":"microbundle watch -o dist/ --sourcemap false --compress false"},"keywords":["react-hooks","hooks","react","utils","lib","event-listener"],"author":{"name":"donavon"},"devDependencies":{"@babel/core":"^7.2.2","@babel/preset-env":"^7.2.3","@babel/preset-react":"^7.0.0","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","react":"^16.8.0","react-dom":"^16.8.0","react-testing-library":"^5.5.0","rimraf":"^2.6.2"},"peerDependencies":{"react":"^16.8.0"},"jest":{"coverageThreshold":{"global":{"branches":100,"functions":100,"lines":100,"statements":100}}},"gitHead":"a5127d0e7155f6a77acd922d3e4e83fb93bece9f","bugs":{"url":"https://github.com/donavon/use-event-listener/issues"},"homepage":"https://github.com/donavon/use-event-listener#readme","_id":"@use-it/event-listener@0.1.3","_nodeVersion":"11.10.1","_npmVersion":"6.7.0","dist":{"integrity":"sha512-UCHkLOVU+xj3/1R8jXz8GzDTowkzfIDPESOBlVC2ndgwUSBEqiFdwCoUEs2lcGhJOOiEdmWxF+T23C5+60eEew==","shasum":"a9920b2819d211cf55e68e830997546eec6886d3","tarball":"https://registry.npmjs.org/@use-it/event-listener/-/event-listener-0.1.3.tgz","fileCount":7,"unpackedSize":8768,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcfeFKCRA9TVsSAnZWagAAXTAP/RzU5BBegNds+zf/hwM3\nmD/IDLI4l1xmjWJLVxQ2FpidSX4sCo0q3aTtythmeLTiQTM/cuVLK1xSzR86\naVMPTvDjozMc3oYwoQOfJMXsTZFEtrmt55jS1hgKyK3YwhjvzcD1HsCmzLpk\n2bJvl7nog+8ToXAZb2utZKMZDhZkUfawSJU6/g2TF6mJyLKICjvFZlLIuefx\ngRidW0oOivPcNqI90cK5INWKht19XTtQ9YkzdL3jLH8ZPeZvMdqVcKlRuSa2\nK2UViqZJaMEaXZXdORTUM6h16urzIr5Qwh8UEizH1QcYbRbrpdTAZMPiv0oJ\nprzsxUkK/7HvISjZDuRHLgb8YupdZI4Rm3O/az0fBxyElMxNASDW+oN0uys2\n8ab+16e6V0fLB+H1Zp5UepaYrbmcNffuEZDRXRDCTXkVrgkGGWlYcuP/9u2g\n6l7ioAP0N25BLli0UKYQ+NuEY3vAPx2/psZqf0dKiB3t9I4aDutTJHcxB3gL\n4M+5k8KnectkolsKom5JLuWrULWOldQ1H12YNneimO+MA0cF4uiw+Pp2UYxn\nxrPwusYOC/RvLw54Edn9TKYDau5vu6Ujs0syzgmMcsn2InTXK8WResxqWSGU\nDAPX0ZOo0wgN7v7D9fsB8Ma47wNl8VvOnkbcmfyOqEtIuz+5Xv1/ivBjfTRq\nK/gL\r\n=jgfU\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGGcGQ8CI3IWXO2wBPxBaops5HmeO9cwwUfKE69YgG04AiA90cOMtX3NwQRGjB2pQVsHCiW0HDbC0o21vyooDNkvFw=="}]},"maintainers":[{"name":"donavon","email":"github@donavon.com"}],"_npmUser":{"name":"donavon","email":"github@donavon.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/event-listener_0.1.3_1551753545945_0.42747341714605724"},"_hasShrinkwrap":false},"0.1.4":{"name":"@use-it/event-listener","publishConfig":{"access":"public"},"version":"0.1.4","description":"A custom React Hook that provides a useEventListener.","main":"dist/event-listener.js","umd:main":"dist/event-listener.umd.js","module":"dist/event-listener.m.js","source":"src/index.js","types":"types/index.d.ts","license":"MIT","repository":{"type":"git","url":"git+https://github.com/donavon/use-event-listener.git"},"scripts":{"prepublishOnly":"npm run build","lint":"eslint src","test":"jest --verbose --coverage --silent && tsc -p types/tsconfig.json","test:watch":"jest --watch --runInBand --silent","tsc":"tsc -p types/tsconfig.json","prebuild":"npm run lint && npm t && rimraf dist","build":"microbundle -o dist/ --sourcemap false --target web","dev":"microbundle watch -o dist/ --sourcemap false --compress false"},"keywords":["react-hooks","hooks","react","utils","lib","event-listener"],"author":{"name":"donavon"},"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.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","react":"^16.9.0","react-dom":"^16.9.0","react-test-renderer":"^16.13.0","rimraf":"^2.6.2","typescript":"^3.8.3"},"peerDependencies":{"react":"^16.8.0"},"jest":{"coverageThreshold":{"global":{"branches":100,"functions":100,"lines":100,"statements":100}}},"gitHead":"1a0d58b21299c0c829fa9ae64d867c1643a569b3","bugs":{"url":"https://github.com/donavon/use-event-listener/issues"},"homepage":"https://github.com/donavon/use-event-listener#readme","_id":"@use-it/event-listener@0.1.4","_nodeVersion":"10.22.0","_npmVersion":"6.14.6","dist":{"integrity":"sha512-P8pWyMUcBXVRVcCUq9xO6t5AypmQ34KVmGaRdYHRFu3iUr5Ysfk/7pykZtGjyWdk33mMvhkzcmU0iauDL3fteQ==","shasum":"b329783592f03f9751736f614712bdd6ab7ba4f7","tarball":"https://registry.npmjs.org/@use-it/event-listener/-/event-listener-0.1.4.tgz","fileCount":9,"unpackedSize":13270,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfGa1uCRA9TVsSAnZWagAASVIQAJmcQGWB0RpmOAfpAQD2\nF81bGz9g85ydASSHr5vmpKZXUm/uq1vJHtBC0BUNtcRiE0a+mRL1Pw4g+r/u\ny6JK9Bx8rjClH64Hyhaw2o1zHfNz9TsJQDO7OCFie9JCh3OSSO3ZFVrAWBkh\nTwzdNafwQK1QzW1teNFFgMsv1Ciw6y8WZNCJU3V6Jy46zpl6YdTIENe76d7v\n4wmMB98IPDzERBtQljIkt+4V+ddm5aj9wwIGENyxlkeRKgzYCUrtMayz0yCN\n651PZHkFAdfU9yv7kGoOmjjdXU6n4a48NbcqEp1xCsrkLRJra9g4DA6nGQJ9\n/KbuSrL7ooWIFYAmiJKo5rOZwzFx17/qvTOtsoNplsReLPwMCEYx3vnXrXIM\necBcbZ5JDGOv5/d5BOKuZ1E5prsxHw1ZBfY2NwG8Qr6crYUBG7yh1w+hsc3B\nA/l1k6X+vg5TvXp1TV/qtk37sSFDVhe4+Rpe2TCDNLnAeX67wfUQqBAL4sEe\nfZvyzBSiFRlxpaTlo+J0fJRcdk/7nAwWzmVF4gbt5c4uHx36X8hdgq8H5miH\nKBiKC6K3I7Mm4xRRaNLIebyaUenZ1A5v7xyYYZXuilCkahv10mywlH6shvfK\n4R+NFidTyI24WqN/uCdaLzbfRb+TRhtTjo0iTI+tz78UkixHv7l0dyA2JkA0\nq0Wt\r\n=hRl/\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEIV5bGsrwm4HH5UhMZbfvN6ZOvlADtGOu2laoYRFtAHAiBnLpivEJiGmMMxLvcg2LJAHoK3VGUAUJ4+UENvJMW/Yg=="}]},"maintainers":[{"name":"donavon","email":"github@donavon.com"}],"_npmUser":{"name":"donavon","email":"github@donavon.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/event-listener_0.1.4_1595518318349_0.22434659014592118"},"_hasShrinkwrap":false},"0.1.5":{"name":"@use-it/event-listener","publishConfig":{"access":"public"},"version":"0.1.5","description":"A custom React Hook that provides a useEventListener.","main":"dist/event-listener.js","umd:main":"dist/event-listener.umd.js","module":"dist/event-listener.m.js","source":"src/index.js","types":"types/index.d.ts","license":"MIT","repository":{"type":"git","url":"git+https://github.com/donavon/use-event-listener.git"},"scripts":{"prepublishOnly":"npm run build","lint":"eslint src","test":"jest --verbose --coverage --silent && tsc -p types/tsconfig.json","test:watch":"jest --watch --runInBand --silent","tsc":"tsc -p types/tsconfig.json","prebuild":"npm run lint && npm t && rimraf dist","build":"microbundle -o dist/ --sourcemap false --target web","dev":"microbundle watch -o dist/ --sourcemap false --compress false"},"keywords":["react-hooks","hooks","react","utils","lib","event-listener"],"author":{"name":"donavon"},"devDependencies":{"@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":"^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.13.1","react-test-renderer":"^16.13.1","rimraf":"^3.0.2","typescript":"^3.9.7"},"peerDependencies":{"react":"^16.8.0"},"jest":{"coverageThreshold":{"global":{"branches":100,"functions":100,"lines":100,"statements":100}}},"gitHead":"ddf9248e06a050207e9efabc1dd206e716e3f867","bugs":{"url":"https://github.com/donavon/use-event-listener/issues"},"homepage":"https://github.com/donavon/use-event-listener#readme","_id":"@use-it/event-listener@0.1.5","_nodeVersion":"10.22.0","_npmVersion":"6.14.6","dist":{"integrity":"sha512-SWbhB0iFcoNL1BEldApGTqfB9aoGpU82iZUVTBtZaTFNrVKAGwuQTF15N9MzRvTgyuOASWf1pCKXbdVtKZgeRg==","shasum":"870456241bfef66acea6395c69b66fe516bee3cd","tarball":"https://registry.npmjs.org/@use-it/event-listener/-/event-listener-0.1.5.tgz","fileCount":10,"unpackedSize":13882,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfHW3tCRA9TVsSAnZWagAAuRQP/26BeqsfhHI7GjHdm4IO\n9H/6NWZSH6WY5RBGd+hENoTOA2Eic0x/8lqj3beaNxeP9YD/io3e2xjC7IJV\n7UjUHiCfllIL6pqx0G1Mbglh+hf/NtgOlynPgTBEQCuuQ2f6mlq3gOz9hr4l\ns8f7+caqRLx9BrL4b9e1q8TWLtuUFJ0IZKbLbasCwQXJjiftI0srxSZ04xWM\nHbEYkN/X8Y1UNiYrAb79l7agus5KJmDN7FTQifXC66IIAUYiw/zsSg3YBF5D\nhHSde0HKHY2cX++rN3/EcC8gk2espo2Pi2DsDAM+NkYtjccdtWcqczMTS6Kb\nVPV86tHj48MrB/Cw34DA4+Fpgvwt0kOxEU5C+3UWh3Utsoi2iLXNo+1rjaJ1\n3wAXHA67vaddofC+ldYzlrAEH+E9W94abDlzucbqGjK7PImBzlp6GcZFzpcZ\nwKgf2J+hSL7jPVC9cJWO+DJs8uJWj9cirUsQzkPwfIr2YWYE3wysFvkOvKrU\nlj5CwxAh2bsy6gdwACoQ5C/uyMzN54EIJa/9X0Un3+9s/NhIx4fTbSEv54sl\n4TQ6y5AyYMBHvWa34eqmt8cUbKq86rWlW97AZDlMIt2mo80g7QxkPvQssCNB\nd60nKUE9nekAaC39pSS6W03SIs98HhybzILGsjLr0u4TnIpTI6aXXhmAmFoI\ndAOX\r\n=/5XK\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCyg6fBKs1xeWW0RdYROWnSn6DH7k9GPC+i11l7evEi3AIgLN7k5NkIJlBYWyaLT2YcU8doF4Xpjc6P5lWa8NoQjW8="}]},"maintainers":[{"name":"donavon","email":"github@donavon.com"}],"_npmUser":{"name":"donavon","email":"github@donavon.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/event-listener_0.1.5_1595764204971_0.37417435509726915"},"_hasShrinkwrap":false},"0.1.6":{"name":"@use-it/event-listener","publishConfig":{"access":"public"},"version":"0.1.6","description":"A custom React Hook that provides a useEventListener.","main":"dist/event-listener.js","umd:main":"dist/event-listener.umd.js","module":"dist/event-listener.m.js","source":"src/index.js","types":"types/index.d.ts","license":"MIT","repository":{"type":"git","url":"git+https://github.com/donavon/use-event-listener.git"},"scripts":{"prepublishOnly":"npm run build","lint":"eslint src","test":"jest --verbose --coverage --silent && tsc -p types/tsconfig.json","test:watch":"jest --watch --runInBand --silent","tsc":"tsc -p types/tsconfig.json","prebuild":"npm run lint && npm t && rimraf dist","build":"microbundle -o dist/ --sourcemap false --target web","dev":"microbundle watch -o dist/ --sourcemap false --compress false"},"keywords":["react-hooks","hooks","react","utils","lib","event-listener"],"author":{"name":"donavon"},"devDependencies":{"@babel/core":"^7.12.3","@babel/preset-env":"^7.12.1","@babel/preset-react":"^7.12.5","@testing-library/jest-dom":"^5.11.6","@testing-library/react-hooks":"^3.4.2","babel-core":"^7.0.0-bridge.0","babel-jest":"^26.6.3","eslint":"^7.13.0","eslint-config-amex":"^13.1.0","jest":"^26.6.3","microbundle":"^0.12.4","react":"^16.14.0","react-dom":"^16.14.0","react-test-renderer":"^16.14.0","rimraf":"^3.0.2","typescript":"^3.9.7"},"peerDependencies":{"react":"^16.8.0"},"jest":{"coverageThreshold":{"global":{"branches":100,"functions":100,"lines":100,"statements":100}}},"gitHead":"43d647e615b4b02f4800f7fb0f82205e8de7a033","bugs":{"url":"https://github.com/donavon/use-event-listener/issues"},"homepage":"https://github.com/donavon/use-event-listener#readme","_id":"@use-it/event-listener@0.1.6","_nodeVersion":"14.14.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-e6V7vbU8xpuqy4GZkTLExHffOFgxmGHo3kNWnlhzM/zcX2v+idbD/HaJ9sKdQMgTh+L7MIhdRDXGX3SdAViZzA==","shasum":"5776274fec72f3f25af9ead1898e7f45bc435812","tarball":"https://registry.npmjs.org/@use-it/event-listener/-/event-listener-0.1.6.tgz","fileCount":10,"unpackedSize":14490,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJftpEkCRA9TVsSAnZWagAA5yAP/0Os5fD4nndwDHLZNXUs\nFIy50fH3xWbQEsQ4jgLS9ZJmAURgDfJaT4Gi1lAdpvE8StHyuVYUCksHs3oG\n5M9ti3qAlaOfPjib2hHeoW57ESN1z1SiF5AeUlZZKGs7pZ8Hzhw6qEUyNV3Q\n1tTZUYVTEXarYOvs7mT6NUN93cRqlc7E5rNWQIoVyTuH215/0zGP9Xh1DjZg\nQVs8Da7ll0+cvchMZBaz7LhVFCIEjVOniUXwQ8rHFqtKzxKnhcNir/3WGGtO\ngQASssByRN9z+FMHtRsy7oXHWJ17cmvS0ct6qea0IPo69R6NtS7UtdzVHaPS\nf93y/nMlhWnfUS0wjTrSJHSyCiiaQVcfYRhzXbyrtMTYWCt3615hnRPU/Kpy\ndzzWPZuVNBYBTXAaCqm5rsL0v11HGJc6IPj9yFzXmkt2zfATfJg4ybXBoOuR\nMVCSXJ+V1SgLwhBUhh7ka7Q/nqNEyGaRscCvS84O3hQ7fUleO5c7Be+QViLs\nerfLLnu3oZ1dc9kVYfkLTj+uZSlsFCJHOQaGJqovV0xGLGNbzco3LlT6uSuX\nV08PYEXx/T29u+2/xHYZ1/XZaWPJxuVFIY1kZ7a1sXnhQfb5VUdJkJVYB5J7\nNXsHwlbF2h1ulzlxZi/WpfMUG9YKnPcC6MwlSBXUGutIRhy9FgYwX3N8RXvD\n/pu7\r\n=QT7O\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCGMi89znApwa0XShzAz/hvtcpB/IdpoXP5xcvTFxk2SAIhAKyDnqFTUS82Xpv0wdUkMO/OanUDHFITxK9woDjjx/n/"}]},"_npmUser":{"name":"donavon","email":"github@donavon.com"},"directories":{},"maintainers":[{"name":"donavon","email":"github@donavon.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/event-listener_0.1.6_1605800228231_0.3095772568511892"},"_hasShrinkwrap":false},"1.0.0-beta.1":{"name":"@use-it/event-listener","publishConfig":{"access":"public","tag":"next"},"version":"1.0.0-beta.1","description":"A custom React Hook that provides a useEventListener.","license":"MIT","author":{"name":"Donavon West","email":"github@donavon.com","url":"https://donavon.com/"},"main":"dist/index.js","typings":"dist/index.d.ts","engines":{"node":">=10"},"keywords":["react-hooks","hooks","react","utils","lib","event-listener"],"scripts":{"start":"tsdx watch","build":"tsdx build","test:watch":"tsdx test --passWithNoTests --watchAll","test":"tsdx test --passWithNoTests --coverage","lint":"tsdx lint","prepare":"tsdx build","size":"size-limit","analyze":"size-limit --why"},"peerDependencies":{"react":">=16.8"},"husky":{"hooks":{"pre-commit":"tsdx lint"}},"prettier":{"printWidth":80,"semi":true,"singleQuote":true,"trailingComma":"es5"},"module":"dist/use-event-listener-ts.esm.js","size-limit":[{"path":"dist/use-event-listener-ts.cjs.production.min.js","limit":"10 KB"},{"path":"dist/use-event-listener-ts.esm.js","limit":"10 KB"}],"jest":{"coverageThreshold":{"global":{"branches":100,"functions":100,"lines":100,"statements":100}}},"devDependencies":{"@size-limit/preset-small-lib":"^4.9.0","@testing-library/react-hooks":"^3.4.2","@types/react":"^17.0.0","@types/react-dom":"^17.0.0","husky":"^4.3.0","react":"^17.0.1","react-dom":"^17.0.1","react-test-renderer":"^17.0.1","size-limit":"^4.9.0","tsdx":"^0.14.1","tslib":"^2.0.3","typescript":"^4.1.2"},"dependencies":{"global-event-target":"^0.1.0"},"readme":"# @use-it/event-listener\n\nA custom React Hook that provides a declarative addEventListener.\n\n> Note: Version 1.x has been completely rewritten in TypeScript. See [Parameters](#parameters) below important breaking changes.\n\n[![npm version](https://badge.fury.io/js/%40use-it%2Fevent-listener.svg)](https://badge.fury.io/js/%40use-it%2Fevent-listener) [![All Contributors](https://img.shields.io/badge/all_contributors-7-orange.svg?style=flat-square)](#contributors)\n\nThis hook was inspired by [Dan Abramov](https://github.com/gaearon)'s\nblog post\n[\"Making setInterval Declarative with React Hooks\"](https://overreacted.io/making-setinterval-declarative-with-react-hooks/).\n\nI needed a way to simplify the plumbing around adding and removing an event listener\nin a custom hook.\nThat lead to a [chain of tweets](https://twitter.com/donavon/status/1093612936621379584)\nbetween Dan and myself.\n\n## Installation\n\n```bash\n$ npm i @use-it/event-listener\n```\n\nor\n\n```bash\n$ yarn add @use-it/event-listener\n```\n\n## Usage\n\nHere is a basic setup.\n\n```js\nuseEventListener(eventName, handler [, options]);\n```\n\n### Parameters <a name=\"parameters\"></a>\n\nHere are the parameters that you can use. (\\* = optional).\n\n> Note: in version 1.0, `element` is now a key in `options`. This represents a **breaking change** that _could_ effect your code. Be sure to test before updating to 1.x from version 0.x.\n\n| Parameter   | Description                                                                                                                                                                                                                        |\n| :---------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `eventName` | The event name (string). Here is a list of [common events](https://developer.mozilla.org/en-US/docs/Web/Events).                                                                                                                   |\n| `handler`   | A function that will be called whenever `eventName` fires on `element`. New in version 1.x: this can also be an object implementing the [EventListener](https://developer.mozilla.org/en-US/docs/Web/API/EventListener) interface. |\n| `options`\\* | An optional `Options` object (see below).                                                                                                                                                                                          |\n\n### Options <a name=\"parameters\"></a>\n\nHere is the Options object. All keys are optional.\nSee [MDN](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener) for details on `capture`, `passive`, and `once`.\n\n| Key       | Description                                                                                                                                                          |\n| --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `element` | An optional element to listen on. Defaults to `global` (i.e. `window`)                                                                                               |\n| `capture` | A Boolean indicating that events of this type will be dispatched to the registered listener before being dispatched to any `EventTarget` beneath it in the DOM tree. |\n| `passive` | A Boolean indicating that the handler will never call `preventDefault()`.                                                                                            |\n| `once`    | A Boolean indicating that the handler should be invoked at most once after being added. If true, the handler would be automatically removed when invoked.            |\n\n### Return\n\nThis hook returns nothing.\n\n## Example\n\nLet's look at some sample code. Suppose you would like to track the mouse\nposition. You _could_ subscribe to mouse move events with like this.\n\n```js\nconst useMouseMove = () => {\n  const [coords, setCoords] = useState([0, 0]);\n\n  useEffect(() => {\n    const handler = ({ clientX, clientY }) => {\n      setCoords([clientX, clientY]);\n    };\n    window.addEventListener('mousemove', handler);\n    return () => {\n      window.removeEventListener('mousemove', handler);\n    };\n  }, []);\n\n  return coords;\n};\n```\n\nHere we're using `useEffect` to roll our own handler add/remove event listener.\n\n`useEventListener` abstracts this away. You only need to care about the event name\nand the handler function.\n\n```js\nconst useMouseMove = () => {\n  const [coords, setCoords] = useState([0, 0]);\n  useEventListener('mousemove', ({ clientX, clientY }) => {\n    setCoords([clientX, clientY]);\n  });\n  return coords;\n};\n```\n\nIn TypeScript you can specify the type of the `Event` to be more specific. Here we set the handler's event type to `MouseEvent`.\n\n```ts\nconst useMouseMove = () => {\n  const [coords, setCoords] = React.useState([0, 0]);\n  useEventListener('mousemove', ({ clientX, clientY }: MouseEvent) => {\n    setCoords([clientX, clientY]);\n  });\n  return coords;\n};\n```\n\n## Live demo\n\nYou can view/edit the sample code above on CodeSandbox.\n\n[![Edit demo app on CodeSandbox](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/k38lyx2q9o)\n\n## License\n\n**[MIT](LICENSE)** Licensed\n\n## Contributors\n\nThanks goes to these wonderful people ([emoji key](https://github.com/all-contributors/all-contributors#emoji-key)):\n\n<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->\n<!-- prettier-ignore-start -->\n<!-- markdownlint-disable -->\n<table>\n  <tr>\n    <td align=\"center\"><a href=\"http://donavon.com\"><img src=\"https://avatars3.githubusercontent.com/u/887639?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>Donavon West</b></sub></a><br /><a href=\"#infra-donavon\" title=\"Infrastructure (Hosting, Build-Tools, etc)\">🚇</a> <a href=\"https://github.com/donavon/use-event-listener/commits?author=donavon\" title=\"Tests\">⚠️</a> <a href=\"#example-donavon\" title=\"Examples\">💡</a> <a href=\"#ideas-donavon\" title=\"Ideas, Planning, & Feedback\">🤔</a> <a href=\"#maintenance-donavon\" title=\"Maintenance\">🚧</a> <a href=\"https://github.com/donavon/use-event-listener/pulls?q=is%3Apr+reviewed-by%3Adonavon\" title=\"Reviewed Pull Requests\">👀</a> <a href=\"#tool-donavon\" title=\"Tools\">🔧</a> <a href=\"https://github.com/donavon/use-event-listener/commits?author=donavon\" title=\"Code\">💻</a></td>\n    <td align=\"center\"><a href=\"https://github.com/third774\"><img src=\"https://avatars3.githubusercontent.com/u/8732191?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>Kevin Kipp</b></sub></a><br /><a href=\"https://github.com/donavon/use-event-listener/commits?author=third774\" title=\"Code\">💻</a></td>\n    <td align=\"center\"><a href=\"https://github.com/wKovacs64\"><img src=\"https://avatars1.githubusercontent.com/u/1288694?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>Justin Hall</b></sub></a><br /><a href=\"https://github.com/donavon/use-event-listener/commits?author=wKovacs64\" title=\"Code\">💻</a> <a href=\"https://github.com/donavon/use-event-listener/commits?author=wKovacs64\" title=\"Documentation\">📖</a></td>\n    <td align=\"center\"><a href=\"https://github.com/huan086\"><img src=\"https://avatars2.githubusercontent.com/u/1448788?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>Jeow Li Huan</b></sub></a><br /><a href=\"https://github.com/donavon/use-event-listener/pulls?q=is%3Apr+reviewed-by%3Ahuan086\" title=\"Reviewed Pull Requests\">👀</a></td>\n    <td align=\"center\"><a href=\"http://normanrz.com/\"><img src=\"https://avatars1.githubusercontent.com/u/335438?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>Norman Rzepka</b></sub></a><br /><a href=\"#ideas-normanrz\" title=\"Ideas, Planning, & Feedback\">🤔</a></td>\n    <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>\n    <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>\n  </tr>\n</table>\n\n<!-- markdownlint-enable -->\n<!-- prettier-ignore-end -->\n\n<!-- ALL-CONTRIBUTORS-LIST:END -->\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n","readmeFilename":"README.md","gitHead":"8a26ef702011093395f64902384b8c6d014bb213","_id":"@use-it/event-listener@1.0.0-beta.1","_nodeVersion":"14.14.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-DjZwpRHR2YGvy9m44FbnbTWO8zA/L3xG+HsIqDhNqWz3jG7sPTTtwofHg4t0435lvQXEqZHp8aQSVQsJxMs3tQ==","shasum":"be97394e68b4dc7c74a741e835301fea376bd848","tarball":"https://registry.npmjs.org/@use-it/event-listener/-/event-listener-1.0.0-beta.1.tgz","fileCount":12,"unpackedSize":29005,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfudiICRA9TVsSAnZWagAAaP4QAJ4oPO3lntdac+zLHYGZ\nrTtB+LQt9mOOh31pesJ4NFY6ZFyziTNRw6YQBApoiWtLSU5IeFG1DSfhrtdP\n7qyN8A5FS0jliocsqGxnqhfBuWpmW8ybJeklp+g8EQ5MWBBFV2IELM+pXgGf\nkeK2TlOrlnPJG65idsXRHUr2KOwR7+NNwKw2JhadkKM3Y0iPJfaYQAiMAC5Y\nV6l2L3nuWxPVy+N9/AYAU4oaTVbZJxP8I6omD/YAAIJnn8ppihsYmQdnaZ2u\nsLfHxE60QSbT1Loz+Nu/pW7SWJFef4jG+IV0XcFj+OBApEc+012K/nH1wGYW\nanq9HJge1LxL5dmYbfGky/6f0Th1bXrIg5KsFqTXUI2TdEZgdkN6grqJL3IN\nG0fJZHAT6a1l+/B7nTt0G2z8deB/wmyJXhheXOb2X8noTBsbZkWAU65J37+A\nk5UN9N8DX13wn1KlG1VfKKh+MsbBDkM9Cr0O08TiZhnQ/XBXPfUf1cm8ojWj\n6hTmadklu+ZzHlttwvg0yR+X8JIBBKwlW0nZ6wHJurvc9n2n+pdZkx8I0Z2U\nw2Zn38OIDFkcSox6xqrMbCRwsilE8FhOknFUHrI2lRGDVyx3j4c7VUvWpjP/\nwh2kVnTv71zzG9sBqFJ9rdK7OFmdzFQO6LozUEsdtt1RLELbMr2yNk9Cr9Ut\nOMQw\r\n=iO6L\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDDt0nxMnxgoy1s3D1042mPCHi0NQLzCyRz1kIc4Tx3rwIhALsescdEvAxed81+UtENtgx+b0wplfg0fCfr85slciCH"}]},"_npmUser":{"name":"donavon","email":"github@donavon.com"},"directories":{},"maintainers":[{"name":"donavon","email":"github@donavon.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/event-listener_1.0.0-beta.1_1606015111693_0.40529700904469745"},"_hasShrinkwrap":false},"1.0.0-beta.2":{"name":"@use-it/event-listener","publishConfig":{"access":"public","tag":"next"},"version":"1.0.0-beta.2","description":"A custom React Hook that provides a useEventListener.","license":"MIT","author":{"name":"Donavon West","email":"github@donavon.com","url":"https://donavon.com/"},"main":"dist/index.js","typings":"dist/index.d.ts","engines":{"node":">=10"},"keywords":["react-hooks","hooks","react","utils","lib","event-listener"],"scripts":{"start":"tsdx watch","build":"tsdx build","test:watch":"tsdx test --passWithNoTests --watchAll","test":"tsdx test --passWithNoTests --coverage","lint":"tsdx lint","prepare":"tsdx build","size":"size-limit","analyze":"size-limit --why"},"peerDependencies":{"react":">=16.8"},"husky":{"hooks":{"pre-commit":"tsdx lint"}},"prettier":{"printWidth":80,"semi":true,"singleQuote":true,"trailingComma":"es5"},"module":"dist/use-event-listener-ts.esm.js","size-limit":[{"path":"dist/use-event-listener-ts.cjs.production.min.js","limit":"10 KB"},{"path":"dist/use-event-listener-ts.esm.js","limit":"10 KB"}],"jest":{"coverageThreshold":{"global":{"branches":100,"functions":100,"lines":100,"statements":100}}},"devDependencies":{"@size-limit/preset-small-lib":"^4.9.0","@testing-library/react-hooks":"^3.4.2","@types/react":"^17.0.0","@types/react-dom":"^17.0.0","husky":"^4.3.0","react":"^17.0.1","react-dom":"^17.0.1","react-test-renderer":"^17.0.1","size-limit":"^4.9.0","tsdx":"^0.14.1","tslib":"^2.0.3","typescript":"^4.1.2"},"dependencies":{"global-event-target":"^0.1.0"},"readme":"# @use-it/event-listener\n\nA custom React Hook that provides a declarative addEventListener.\n\n> Note: Version 1.x has been completely rewritten in TypeScript. See [Parameters](#parameters) below important breaking changes.\n\n[![npm version](https://badge.fury.io/js/%40use-it%2Fevent-listener.svg)](https://badge.fury.io/js/%40use-it%2Fevent-listener) [![All Contributors](https://img.shields.io/badge/all_contributors-7-orange.svg?style=flat-square)](#contributors)\n\nThis hook was inspired by [Dan Abramov](https://github.com/gaearon)'s\nblog post\n[\"Making setInterval Declarative with React Hooks\"](https://overreacted.io/making-setinterval-declarative-with-react-hooks/).\n\nI needed a way to simplify the plumbing around adding and removing an event listener\nin a custom hook.\nThat lead to a [chain of tweets](https://twitter.com/donavon/status/1093612936621379584)\nbetween Dan and myself.\n\n## Installation\n\n```bash\n$ npm i @use-it/event-listener\n```\n\nor\n\n```bash\n$ yarn add @use-it/event-listener\n```\n\n## Usage\n\nHere is a basic setup.\n\n```js\nuseEventListener(eventName, handler [, options]);\n```\n\n### Parameters <a name=\"parameters\"></a>\n\nHere are the parameters that you can use. (\\* = optional).\n\n> Note: in version 1.0, `element` is now a key in `options`. This represents a **breaking change** that _could_ effect your code. Be sure to test before updating to 1.x from version 0.x.\n\n| Parameter   | Description                                                                                                                                                                                                                        |\n| :---------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `eventName` | The event name (string). Here is a list of [common events](https://developer.mozilla.org/en-US/docs/Web/Events).                                                                                                                   |\n| `handler`   | A function that will be called whenever `eventName` fires on `element`. New in version 1.x: this can also be an object implementing the [EventListener](https://developer.mozilla.org/en-US/docs/Web/API/EventListener) interface. |\n| `options`\\* | An optional `Options` object (see below).                                                                                                                                                                                          |\n\n### Options <a name=\"parameters\"></a>\n\nHere is the Options object. All keys are optional.\nSee [MDN](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener) for details on `capture`, `passive`, and `once`.\n\n| Key       | Description                                                                                                                                                          |\n| --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `element` | An optional element to listen on. Defaults to `global` (i.e. `window`)                                                                                               |\n| `capture` | A Boolean indicating that events of this type will be dispatched to the registered listener before being dispatched to any `EventTarget` beneath it in the DOM tree. |\n| `passive` | A Boolean indicating that the handler will never call `preventDefault()`.                                                                                            |\n| `once`    | A Boolean indicating that the handler should be invoked at most once after being added. If true, the handler would be automatically removed when invoked.            |\n\n### Return\n\nThis hook returns nothing.\n\n## Example\n\nLet's look at some sample code. Suppose you would like to track the mouse\nposition. You _could_ subscribe to mouse move events with like this.\n\n```js\nconst useMouseMove = () => {\n  const [coords, setCoords] = useState([0, 0]);\n\n  useEffect(() => {\n    const handler = ({ clientX, clientY }) => {\n      setCoords([clientX, clientY]);\n    };\n    window.addEventListener('mousemove', handler);\n    return () => {\n      window.removeEventListener('mousemove', handler);\n    };\n  }, []);\n\n  return coords;\n};\n```\n\nHere we're using `useEffect` to roll our own handler add/remove event listener.\n\n`useEventListener` abstracts this away. You only need to care about the event name\nand the handler function.\n\n```js\nconst useMouseMove = () => {\n  const [coords, setCoords] = useState([0, 0]);\n  useEventListener('mousemove', ({ clientX, clientY }) => {\n    setCoords([clientX, clientY]);\n  });\n  return coords;\n};\n```\n\nIn TypeScript you can specify the type of the `Event` to be more specific. Here we set the handler's event type to `MouseEvent`.\n\n```ts\nconst useMouseMove = () => {\n  const [coords, setCoords] = React.useState([0, 0]);\n  useEventListener('mousemove', ({ clientX, clientY }: MouseEvent) => {\n    setCoords([clientX, clientY]);\n  });\n  return coords;\n};\n```\n\n## Live demo\n\nYou can view/edit the sample code above on CodeSandbox.\n\n[![Edit demo app on CodeSandbox](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/k38lyx2q9o)\n\n## License\n\n**[MIT](LICENSE)** Licensed\n\n## Contributors\n\nThanks goes to these wonderful people ([emoji key](https://github.com/all-contributors/all-contributors#emoji-key)):\n\n<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->\n<!-- prettier-ignore-start -->\n<!-- markdownlint-disable -->\n<table>\n  <tr>\n    <td align=\"center\"><a href=\"http://donavon.com\"><img src=\"https://avatars3.githubusercontent.com/u/887639?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>Donavon West</b></sub></a><br /><a href=\"#infra-donavon\" title=\"Infrastructure (Hosting, Build-Tools, etc)\">🚇</a> <a href=\"https://github.com/donavon/use-event-listener/commits?author=donavon\" title=\"Tests\">⚠️</a> <a href=\"#example-donavon\" title=\"Examples\">💡</a> <a href=\"#ideas-donavon\" title=\"Ideas, Planning, & Feedback\">🤔</a> <a href=\"#maintenance-donavon\" title=\"Maintenance\">🚧</a> <a href=\"https://github.com/donavon/use-event-listener/pulls?q=is%3Apr+reviewed-by%3Adonavon\" title=\"Reviewed Pull Requests\">👀</a> <a href=\"#tool-donavon\" title=\"Tools\">🔧</a> <a href=\"https://github.com/donavon/use-event-listener/commits?author=donavon\" title=\"Code\">💻</a></td>\n    <td align=\"center\"><a href=\"https://github.com/third774\"><img src=\"https://avatars3.githubusercontent.com/u/8732191?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>Kevin Kipp</b></sub></a><br /><a href=\"https://github.com/donavon/use-event-listener/commits?author=third774\" title=\"Code\">💻</a></td>\n    <td align=\"center\"><a href=\"https://github.com/wKovacs64\"><img src=\"https://avatars1.githubusercontent.com/u/1288694?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>Justin Hall</b></sub></a><br /><a href=\"https://github.com/donavon/use-event-listener/commits?author=wKovacs64\" title=\"Code\">💻</a> <a href=\"https://github.com/donavon/use-event-listener/commits?author=wKovacs64\" title=\"Documentation\">📖</a></td>\n    <td align=\"center\"><a href=\"https://github.com/huan086\"><img src=\"https://avatars2.githubusercontent.com/u/1448788?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>Jeow Li Huan</b></sub></a><br /><a href=\"https://github.com/donavon/use-event-listener/pulls?q=is%3Apr+reviewed-by%3Ahuan086\" title=\"Reviewed Pull Requests\">👀</a></td>\n    <td align=\"center\"><a href=\"http://normanrz.com/\"><img src=\"https://avatars1.githubusercontent.com/u/335438?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>Norman Rzepka</b></sub></a><br /><a href=\"#ideas-normanrz\" title=\"Ideas, Planning, & Feedback\">🤔</a></td>\n    <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>\n    <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>\n  </tr>\n</table>\n\n<!-- markdownlint-enable -->\n<!-- prettier-ignore-end -->\n\n<!-- ALL-CONTRIBUTORS-LIST:END -->\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n","readmeFilename":"README.md","gitHead":"3119fad2036e0a842e0b2df389850bac07649d2b","_id":"@use-it/event-listener@1.0.0-beta.2","_nodeVersion":"14.14.0","_npmVersion":"6.14.9","dist":{"integrity":"sha512-X4D4ROGHPeBmkCil4R2tyL4EgXfxNHbCpDLM92S35hOhvMIhSOYx27lPKops24y/33wW74weudq8pqmawpSRqw==","shasum":"816a44fd25487508d79d85febd41756fdc980410","tarball":"https://registry.npmjs.org/@use-it/event-listener/-/event-listener-1.0.0-beta.2.tgz","fileCount":12,"unpackedSize":30489,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfuowqCRA9TVsSAnZWagAAhEsQAIHHSGYx+7J12C9fIWuh\nAU3a3RBIrY7BrvgMkkMBYTtoRVbtipPnXMno5mmfvZu46f/LKlS2hlvgQ6Qy\nDnImMOj6nWni1r30zxtYGMRVAKWR/tmQAKAffajuwRIUwnGiJYOUDSMRiQ+l\nWPyeXvUkVaVuIVov9+sEDZtPqNj9IkgpL3nZp57bUzJuaZwUWUhZZ5N5K4Zy\nJSbKsPsNQDdFHkQMq0REIWkTXm/pdmYvbYfUHh4CBx/TBbQXZzrebAevedAE\nUHqC2SkLv+j7kJt77L+1gPZYR60Ce7ob0VPq31or51gCcEn45W619f7RJ3n1\njlA8lMzRad2Ykro+QHQTvt/A3sdjAyufU4SlCEwg15KkgIO2CEnbn7T8FKwk\nSleCzLyJo/fytGQ/67J18xmwy9EmSPtHhJH0rwbPWnfx5OLnFPRIkBB+Jvm7\nMiyqeKP24ajfesHZeDFdK2Inef/pUNxmt9Yu35M1lfrtttHM/mfdvfv7LlAL\ncRnBjv3NoIiwRAkegq2EmDVi8ajs3QjaFEHtaw6uxuzaxIT86yG7jlV4LZDZ\n5PSw6sB6kC4gtraArzM6eaMc/TA+gPFt9Crs7DybsSr0as+ZOJO8SEoWETIg\nQeznSCbeFyjcCRgStdwPfTYL+KbzwP5b/J4d0cGN89OgLeUMw15b0CQkb18H\niz0c\r\n=c8+v\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIG5isvymz5GUT350Y2Ski2rQsct/QwGDRtQNjswgdjuGAiADrTl8XlvpkkLVaG4+iWFg6gRyOHijUqStEy+GqQQp+Q=="}]},"_npmUser":{"name":"donavon","email":"github@donavon.com"},"directories":{},"maintainers":[{"name":"donavon","email":"github@donavon.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/event-listener_1.0.0-beta.2_1606061097601_0.5104679398485454"},"_hasShrinkwrap":false},"1.0.0-beta.3":{"name":"@use-it/event-listener","publishConfig":{"access":"public","tag":"next"},"version":"1.0.0-beta.3","description":"A custom React Hook that provides a useEventListener.","license":"MIT","author":{"name":"Donavon West","email":"github@donavon.com","url":"https://donavon.com/"},"main":"dist/index.js","typings":"dist/index.d.ts","engines":{"node":">=10"},"keywords":["react-hooks","hooks","react","utils","lib","event-listener"],"scripts":{"start":"tsdx watch","build":"tsdx build","test:watch":"tsdx test --passWithNoTests --watchAll","test":"tsdx test --passWithNoTests --coverage","lint":"tsdx lint","prepare":"tsdx build","size":"size-limit","analyze":"size-limit --why"},"peerDependencies":{"react":">=16.8"},"husky":{"hooks":{"pre-commit":"tsdx lint"}},"prettier":{"printWidth":80,"semi":true,"singleQuote":true,"trailingComma":"es5"},"module":"dist/use-event-listener-ts.esm.js","size-limit":[{"path":"dist/use-event-listener-ts.cjs.production.min.js","limit":"10 KB"},{"path":"dist/use-event-listener-ts.esm.js","limit":"10 KB"}],"jest":{"coverageThreshold":{"global":{"branches":100,"functions":100,"lines":100,"statements":100}}},"devDependencies":{"@size-limit/preset-small-lib":"^4.9.0","@testing-library/react":"^11.2.2","@testing-library/react-hooks":"^3.4.2","@types/react":"^17.0.0","@types/react-dom":"^17.0.0","husky":"^4.3.0","react":"^17.0.1","react-dom":"^17.0.1","react-test-renderer":"^17.0.1","size-limit":"^4.9.0","tsdx":"^0.14.1","tslib":"^2.0.3","typescript":"^4.1.2"},"dependencies":{"global-event-target":"^0.1.0"},"readme":"# @use-it/event-listener\n\nA custom React Hook that provides a declarative addEventListener.\n\n> Note: Version 1.x has been completely rewritten in TypeScript. See [Parameters](#parameters) below important breaking changes.\n\n[![npm version](https://badge.fury.io/js/%40use-it%2Fevent-listener.svg)](https://badge.fury.io/js/%40use-it%2Fevent-listener) [![All Contributors](https://img.shields.io/badge/all_contributors-7-orange.svg?style=flat-square)](#contributors)\n\nThis hook was inspired by [Dan Abramov](https://github.com/gaearon)'s\nblog post\n[\"Making setInterval Declarative with React Hooks\"](https://overreacted.io/making-setinterval-declarative-with-react-hooks/).\n\nI needed a way to simplify the plumbing around adding and removing an event listener\nin a custom hook.\nThat lead to a [chain of tweets](https://twitter.com/donavon/status/1093612936621379584)\nbetween Dan and myself.\n\n## Installation\n\n```bash\n$ npm i @use-it/event-listener\n```\n\nor\n\n```bash\n$ yarn add @use-it/event-listener\n```\n\n## Usage\n\nHere is a basic setup.\n\n```js\nuseEventListener(eventName, handler [, options]);\n```\n\n### Parameters <a name=\"parameters\"></a>\n\nHere are the parameters that you can use. (\\* = optional).\n\n> Note: in version 1.0, `element` is now a key in `options`. This represents a **breaking change** that _could_ effect your code. Be sure to test before updating to 1.x from version 0.x.\n\n| Parameter   | Description                                                                                                                                                                                                                        |\n| :---------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `eventName` | The event name (string). Here is a list of [common events](https://developer.mozilla.org/en-US/docs/Web/Events).                                                                                                                   |\n| `handler`   | A function that will be called whenever `eventName` fires on `element`. New in version 1.x: this can also be an object implementing the [EventListener](https://developer.mozilla.org/en-US/docs/Web/API/EventListener) interface. |\n| `options`\\* | An optional `Options` object (see below).                                                                                                                                                                                          |\n\n### Options <a name=\"parameters\"></a>\n\nHere is the Options object. All keys are optional.\nSee [MDN](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener) for details on `capture`, `passive`, and `once`.\n\n| Key       | Description                                                                                                                                                          |\n| --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `element` | An optional element to listen on. Defaults to `global` (i.e. `window`)                                                                                               |\n| `capture` | A Boolean indicating that events of this type will be dispatched to the registered listener before being dispatched to any `EventTarget` beneath it in the DOM tree. |\n| `passive` | A Boolean indicating that the handler will never call `preventDefault()`.                                                                                            |\n| `once`    | A Boolean indicating that the handler should be invoked at most once after being added. If true, the handler would be automatically removed when invoked.            |\n\n### Return\n\nThis hook returns nothing.\n\n## Example\n\nLet's look at some sample code. Suppose you would like to track the mouse\nposition. You _could_ subscribe to mouse move events with like this.\n\n```js\nconst useMouseMove = () => {\n  const [coords, setCoords] = useState([0, 0]);\n\n  useEffect(() => {\n    const handler = ({ clientX, clientY }) => {\n      setCoords([clientX, clientY]);\n    };\n    window.addEventListener('mousemove', handler);\n    return () => {\n      window.removeEventListener('mousemove', handler);\n    };\n  }, []);\n\n  return coords;\n};\n```\n\nHere we're using `useEffect` to roll our own handler add/remove event listener.\n\n`useEventListener` abstracts this away. You only need to care about the event name\nand the handler function.\n\n```js\nconst useMouseMove = () => {\n  const [coords, setCoords] = useState([0, 0]);\n  useEventListener('mousemove', ({ clientX, clientY }) => {\n    setCoords([clientX, clientY]);\n  });\n  return coords;\n};\n```\n\nIn TypeScript you can specify the type of the `Event` to be more specific. Here we set the handler's event type to `MouseEvent`.\n\n```ts\nconst useMouseMove = () => {\n  const [coords, setCoords] = React.useState([0, 0]);\n  useEventListener('mousemove', ({ clientX, clientY }: MouseEvent) => {\n    setCoords([clientX, clientY]);\n  });\n  return coords;\n};\n```\n\n## Live demo\n\nYou can view/edit the sample code above on CodeSandbox.\n\n[![Edit demo app on CodeSandbox](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/k38lyx2q9o)\n\n## License\n\n**[MIT](LICENSE)** Licensed\n\n## Contributors\n\nThanks goes to these wonderful people ([emoji key](https://github.com/all-contributors/all-contributors#emoji-key)):\n\n<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->\n<!-- prettier-ignore-start -->\n<!-- markdownlint-disable -->\n<table>\n  <tr>\n    <td align=\"center\"><a href=\"http://donavon.com\"><img src=\"https://avatars3.githubusercontent.com/u/887639?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>Donavon West</b></sub></a><br /><a href=\"#infra-donavon\" title=\"Infrastructure (Hosting, Build-Tools, etc)\">🚇</a> <a href=\"https://github.com/donavon/use-event-listener/commits?author=donavon\" title=\"Tests\">⚠️</a> <a href=\"#example-donavon\" title=\"Examples\">💡</a> <a href=\"#ideas-donavon\" title=\"Ideas, Planning, & Feedback\">🤔</a> <a href=\"#maintenance-donavon\" title=\"Maintenance\">🚧</a> <a href=\"https://github.com/donavon/use-event-listener/pulls?q=is%3Apr+reviewed-by%3Adonavon\" title=\"Reviewed Pull Requests\">👀</a> <a href=\"#tool-donavon\" title=\"Tools\">🔧</a> <a href=\"https://github.com/donavon/use-event-listener/commits?author=donavon\" title=\"Code\">💻</a></td>\n    <td align=\"center\"><a href=\"https://github.com/third774\"><img src=\"https://avatars3.githubusercontent.com/u/8732191?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>Kevin Kipp</b></sub></a><br /><a href=\"https://github.com/donavon/use-event-listener/commits?author=third774\" title=\"Code\">💻</a></td>\n    <td align=\"center\"><a href=\"https://github.com/wKovacs64\"><img src=\"https://avatars1.githubusercontent.com/u/1288694?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>Justin Hall</b></sub></a><br /><a href=\"https://github.com/donavon/use-event-listener/commits?author=wKovacs64\" title=\"Code\">💻</a> <a href=\"https://github.com/donavon/use-event-listener/commits?author=wKovacs64\" title=\"Documentation\">📖</a></td>\n    <td align=\"center\"><a href=\"https://github.com/huan086\"><img src=\"https://avatars2.githubusercontent.com/u/1448788?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>Jeow Li Huan</b></sub></a><br /><a href=\"https://github.com/donavon/use-event-listener/pulls?q=is%3Apr+reviewed-by%3Ahuan086\" title=\"Reviewed Pull Requests\">👀</a></td>\n    <td align=\"center\"><a href=\"http://normanrz.com/\"><img src=\"https://avatars1.githubusercontent.com/u/335438?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>Norman Rzepka</b></sub></a><br /><a href=\"#ideas-normanrz\" title=\"Ideas, Planning, & Feedback\">🤔</a></td>\n    <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>\n    <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>\n  </tr>\n</table>\n\n<!-- markdownlint-enable -->\n<!-- prettier-ignore-end -->\n\n<!-- ALL-CONTRIBUTORS-LIST:END -->\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n","readmeFilename":"README.md","gitHead":"d61e3b181c0a344fff27bfa605472d26ce5b3310","_id":"@use-it/event-listener@1.0.0-beta.3","_nodeVersion":"14.14.0","_npmVersion":"6.14.9","dist":{"integrity":"sha512-DWMD080VdadYM10dl0NflA9W95TViIT8cl739IcHj/cG1cCoCXneXdNGQpH78kjdRBAAnwCb2r+OqErQ0mvA7Q==","shasum":"5ae0d873c337cdbe9d21f449a3f8e9addcb16c46","tarball":"https://registry.npmjs.org/@use-it/event-listener/-/event-listener-1.0.0-beta.3.tgz","fileCount":12,"unpackedSize":32645,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfwYlECRA9TVsSAnZWagAAutgP/RIp4YFCqywJdXNqHYhU\nGeDf0817dRCYnJVFXpxA1TWRKogzI8yl09JwlUrBw4n0pjfmLWmmydKAJOZ4\n2YRf7P4sIVmqdYraOeUsmQdcakC7I14421IQf3CtVY7vTxmeHB4Wzbb/asGc\nlbcmpaeCB5NX2lo+rxHMsgGuiHeLYdrwkTwpCN3h28MFRpjst4mYJHyowaq+\nxIvqq9DFCt5/V5Vta27y5vfFCwFQuLWt9S3bU5ITXLzgN+Qu0Bxn4vOMByty\nOcjwC+LIZwIdBGcFcfhAMSuDxMP0eT+G0sGu90j2GoEwBMNGHDKdJ/sGkYoW\nPZE/qFaqsCn5Y2hcnvc913fzfawZW+zpypJ+GhcBqtGXXY6aONsCJCNi/pa6\n76HVF1ZSgSSiJdNtBYVu9b1J8wDrlX6csMTfHCI5E11KjcWyGsrNkWckgYh2\nt2SrXFJvVMPAo570FTNhA7z9zB169yRiYEtmOfd4SkYA7EotS6UDykI5GQ7f\nvpQ03eBy//QaiFrowbt5+OOT8wLQZEbUXfOvORA0D3SpoeWSNEpWEglalRYy\n3QMkggQaBMfLE/cQ+FOM5KUdh0oLBVznrnzoshefmIHuC5lbXR9ZCjoVfTTG\n3Wq+Jc8ywGf/t35sySiz6MKRACeaul0/By4ltrRsnQoZdZPRIWc74LoTM+pn\nN2Iz\r\n=go76\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCQ99BVwe7x4s+8ATr/PTLFvhwHP8WEtBYdP6aZk7qf5wIhAJOkrdMgFUc/3zAUIrytj9IMc6cBa5tIxveJDwKB5Acl"}]},"_npmUser":{"name":"donavon","email":"github@donavon.com"},"directories":{},"maintainers":[{"name":"donavon","email":"github@donavon.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/event-listener_1.0.0-beta.3_1606519107539_0.7535844217004277"},"_hasShrinkwrap":false},"0.1.7":{"name":"@use-it/event-listener","publishConfig":{"access":"public"},"version":"0.1.7","description":"A custom React Hook that provides a useEventListener.","main":"dist/event-listener.js","umd:main":"dist/event-listener.umd.js","module":"dist/event-listener.m.js","source":"src/index.js","types":"types/index.d.ts","license":"MIT","repository":{"type":"git","url":"git+https://github.com/donavon/use-event-listener.git"},"scripts":{"prepublishOnly":"npm run build","lint":"eslint src","test":"jest --verbose --coverage --silent && tsc -p types/tsconfig.json","test:watch":"jest --watch --runInBand --silent","tsc":"tsc -p types/tsconfig.json","prebuild":"npm run lint && npm t && rimraf dist","build":"microbundle -o dist/ --sourcemap false --target web","dev":"microbundle watch -o dist/ --sourcemap false --compress false"},"keywords":["react-hooks","hooks","react","utils","lib","event-listener"],"author":{"name":"donavon"},"devDependencies":{"@babel/core":"^7.12.3","@babel/preset-env":"^7.12.1","@babel/preset-react":"^7.12.5","@testing-library/jest-dom":"^5.11.6","@testing-library/react-hooks":"^3.4.2","babel-core":"^7.0.0-bridge.0","babel-jest":"^26.6.3","eslint":"^7.13.0","eslint-config-amex":"^13.1.0","jest":"^27.3.1","microbundle":"^0.12.4","react":"^17.0.2","react-dom":"^17.0.2","react-test-renderer":"^16.14.0","rimraf":"^3.0.2","typescript":"^4.4.4"},"peerDependencies":{"react":">=16.8.0"},"jest":{"coverageThreshold":{"global":{"statements":90,"branches":60,"functions":100,"lines":90}}},"gitHead":"0f2e772a0cdc1e9694636b00c4e5b2ed49dafea3","bugs":{"url":"https://github.com/donavon/use-event-listener/issues"},"homepage":"https://github.com/donavon/use-event-listener#readme","_id":"@use-it/event-listener@0.1.7","_nodeVersion":"14.17.0","_npmVersion":"6.14.13","dist":{"integrity":"sha512-hgfExDzUU9uTRTPDCpw2s9jWTxcxmpJya3fK5ADpf5VDpSy8WYwY/kh28XE0tUcbsljeP8wfan48QvAQTSSa3Q==","shasum":"443a9b6df87f2f2961b74d42997ce723a7078623","tarball":"https://registry.npmjs.org/@use-it/event-listener/-/event-listener-0.1.7.tgz","fileCount":10,"unpackedSize":14486,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh2fypCRA9TVsSAnZWagAA2YAP/i2R3PVRbMyOu52gfikT\n/ROfgyIu6N7XtULEveasLsDo7lLgKuCdS36HrZSwu9C3dgdYBfQUSZM8mwbw\n2QqrCUvR/exGwu+uDPszruFrhBJwtV+FD6AojGU7T6EE/otuxdN9wqRaJXBH\naXQq7kO0zqbmXs4rg8AxBeue4QFxhifZhioJ0YV3/mAcdtyPrICeld34k83s\nqZgHCVCxtNJzmsh9bThFt+lf+IV5I0nwDBvbK5gnI2LdAyTyA2TWtr+khKhN\nOvzjHTvEiDbwFLH7RyH7Ms7FUkk0htFGrqqLBzKRyOhnRUgICHE+J4SsB9x8\nj1k8YaIU74w7B0t4FVyJ6jVldCF21Zm1O2cykJdQhTk36TwtIrFkHiLfcxCu\nqigk3xf2DmGhOOE06erXPUwm8iZRcTLEv94trwVKIrTPGErJ6kzsNN9PpqqG\nEOU4+ol9BjyS5Omq8/Ht9VT15vF35f+yRI2qjkethTjP85CtNaZ//78yOyFN\n8KnI+si5UBmYbQJ+afhg+6+JreAkuaoNhjuoMdbWZltBKypKkCQ3vq4SlOaN\nmXNTGGRaMOFjLFWTI8I9fqc0mDY/cUHKT4dQSRcviCTEwfFwkWUbzj+y3Ozm\nWZDvwaZTCBLS/7D/NLRymlUEH708eaWuYKeWkEQ0aTWext0Br4nyRmFhnswV\nk1Cs\r\n=s3Rb\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDQZqZjWfPRA1PHV0/2JysV/DK7Qy73Eh/1DSUcKdi+yAiEAl6EWRmbLWEya2Vv/RMoSlGjJS9B0oXPOLG0tcO6pDLs="}]},"_npmUser":{"name":"donavon","email":"github@donavon.com"},"directories":{},"maintainers":[{"name":"donavon","email":"github@donavon.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/event-listener_0.1.7_1636982134358_0.765916390013605"},"_hasShrinkwrap":false}},"time":{"created":"2019-02-11T00:04:37.419Z","0.0.0":"2019-02-11T00:04:37.676Z","modified":"2022-04-07T09:54:28.949Z","0.1.0":"2019-02-11T03:42:09.673Z","0.1.1":"2019-02-11T04:02:41.940Z","0.1.2":"2019-02-11T18:14:43.515Z","0.1.3":"2019-03-05T02:39:06.128Z","0.1.4":"2020-07-23T15:31:58.547Z","0.1.5":"2020-07-26T11:50:05.098Z","0.1.6":"2020-11-19T15:37:08.349Z","1.0.0-beta.1":"2020-11-22T03:18:31.889Z","1.0.0-beta.2":"2020-11-22T16:04:57.755Z","1.0.0-beta.3":"2020-11-27T23:18:27.691Z","0.1.7":"2021-11-15T13:15:34.482Z"},"maintainers":[{"name":"donavon","email":"github@donavon.com"}],"license":"MIT","readme":"# @use-it/event-listener\n\nA custom React Hook that provides a declarative useEventListener.\n\n[![npm version](https://badge.fury.io/js/%40use-it%2Fevent-listener.svg)](https://badge.fury.io/js/%40use-it%2Fevent-listener) [![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors)\n\nThis hook was inspired by [Dan Abramov](https://github.com/gaearon)'s\nblog post\n[\"Making setInterval Declarative with React Hooks\"](https://overreacted.io/making-setinterval-declarative-with-react-hooks/).\n\nI needed a way to simplify the plumbing around adding and removing an event listener\nin a custom hook.\nThat lead to a [chain of tweets](https://twitter.com/donavon/status/1093612936621379584)\nbetween Dan and myself.\n\n## Installation\n\n```bash\n$ npm i @use-it/event-listener\n```\n\nor\n\n```bash\n$ yarn add @use-it/event-listener\n```\n\n## Usage\n\nHere is a basic setup.\n\n```js\nuseEventListener(eventName, handler, element, options);\n```\n\n### Parameters\n\nHere are the parameters that you can use. (\\* = optional)\n\n| Parameter   | Description                                                                                                                                                                                                                            |\n| :---------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `eventName` | The event name (string). Here is a list of [common events](https://developer.mozilla.org/en-US/docs/Web/Events).                                                                                                                       |\n| `handler`   | A function that will be called whenever `eventName` fires on `element`.                                                                                                                                                                |\n| `element`\\* | An optional element to listen on. Defaults to `global` (i.e., `window`).                                                                                                                                                               |\n| `options`\\* | An object `{ capture?: boolean, passive?: boolean, once?: boolean }` to be passed to `addEventListener`. For advanced use cases. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener) for details. |\n\n### Return\n\nThis hook returns nothing.\n\n## Example\n\nLet's look at some sample code. Suppose you would like to track the mouse\nposition. You _could_ subscribe to mouse move events with like this.\n\n```js\nconst useMouseMove = () => {\n  const [coords, setCoords] = useState([0, 0]);\n\n  useEffect(() => {\n    const handler = ({ clientX, clientY }) => {\n      setCoords([clientX, clientY]);\n    };\n    window.addEventListener('mousemove', handler);\n    return () => {\n      window.removeEventListener('mousemove', handler);\n    };\n  }, []);\n\n  return coords;\n};\n```\n\nHere we're using `useEffect` to roll our own handler add/remove event listener.\n\n`useEventListener` abstracts this away. You only need to care about the event name\nand the handler function.\n\n```js\nconst useMouseMove = () => {\n  const [coords, setCoords] = useState([0, 0]);\n\n  useEventListener('mousemove', ({ clientX, clientY }) => {\n    setCoords([clientX, clientY]);\n  });\n\n  return coords;\n};\n```\n\n## Live demo\n\nYou can view/edit the sample code above on CodeSandbox.\n\n[![Edit demo app on CodeSandbox](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/k38lyx2q9o)\n\n## License\n\n**[MIT](LICENSE)** Licensed\n\n## Contributors\n\nThanks goes to these wonderful people ([emoji key](https://github.com/all-contributors/all-contributors#emoji-key)):\n\n<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->\n<!-- prettier-ignore-start -->\n<!-- markdownlint-disable -->\n<table>\n  <tr>\n    <td align=\"center\"><a href=\"http://donavon.com\"><img src=\"https://avatars3.githubusercontent.com/u/887639?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>Donavon West</b></sub></a><br /><a href=\"#infra-donavon\" title=\"Infrastructure (Hosting, Build-Tools, etc)\">🚇</a> <a href=\"https://github.com/donavon/use-event-listener/commits?author=donavon\" title=\"Tests\">⚠️</a> <a href=\"#example-donavon\" title=\"Examples\">💡</a> <a href=\"#ideas-donavon\" title=\"Ideas, Planning, & Feedback\">🤔</a> <a href=\"#maintenance-donavon\" title=\"Maintenance\">🚧</a> <a href=\"https://github.com/donavon/use-event-listener/pulls?q=is%3Apr+reviewed-by%3Adonavon\" title=\"Reviewed Pull Requests\">👀</a> <a href=\"#tool-donavon\" title=\"Tools\">🔧</a> <a href=\"https://github.com/donavon/use-event-listener/commits?author=donavon\" title=\"Code\">💻</a></td>\n    <td align=\"center\"><a href=\"https://github.com/third774\"><img src=\"https://avatars3.githubusercontent.com/u/8732191?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>Kevin Kipp</b></sub></a><br /><a href=\"https://github.com/donavon/use-event-listener/commits?author=third774\" title=\"Code\">💻</a></td>\n    <td align=\"center\"><a href=\"https://github.com/wKovacs64\"><img src=\"https://avatars1.githubusercontent.com/u/1288694?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>Justin Hall</b></sub></a><br /><a href=\"https://github.com/donavon/use-event-listener/commits?author=wKovacs64\" title=\"Code\">💻</a> <a href=\"https://github.com/donavon/use-event-listener/commits?author=wKovacs64\" title=\"Documentation\">📖</a></td>\n    <td align=\"center\"><a href=\"https://github.com/huan086\"><img src=\"https://avatars2.githubusercontent.com/u/1448788?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>Jeow Li Huan</b></sub></a><br /><a href=\"https://github.com/donavon/use-event-listener/pulls?q=is%3Apr+reviewed-by%3Ahuan086\" title=\"Reviewed Pull Requests\">👀</a></td>\n    <td align=\"center\"><a href=\"http://normanrz.com/\"><img src=\"https://avatars1.githubusercontent.com/u/335438?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>Norman Rzepka</b></sub></a><br /><a href=\"#ideas-normanrz\" title=\"Ideas, Planning, & Feedback\">🤔</a></td>\n    <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>\n    <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>\n  </tr>\n</table>\n\n<!-- markdownlint-enable -->\n<!-- prettier-ignore-end -->\n\n<!-- ALL-CONTRIBUTORS-LIST:END -->\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n","readmeFilename":"README.md","description":"A custom React Hook that provides a useEventListener.","homepage":"https://github.com/donavon/use-event-listener#readme","keywords":["react-hooks","hooks","react","utils","lib","event-listener"],"repository":{"type":"git","url":"git+https://github.com/donavon/use-event-listener.git"},"author":{"name":"donavon"},"bugs":{"url":"https://github.com/donavon/use-event-listener/issues"}}