{"name":"debounce-fn","version":"5.1.2","description":"Debounce a function","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/debounce-fn.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":"./index.js","engines":{"node":">=12"},"scripts":{"test":"xo && ava && tsd"},"keywords":["debounce","function","debouncer","fn","func","throttle","delay","invoked"],"dependencies":{"mimic-fn":"^4.0.0"},"devDependencies":{"ava":"^3.15.0","delay":"^5.0.0","tsd":"^0.19.1","xo":"^0.47.0"},"types":"./index.d.ts","gitHead":"72b5fb4d5e285057a0efce1ed3c28434a1f7b10e","bugs":{"url":"https://github.com/sindresorhus/debounce-fn/issues"},"homepage":"https://github.com/sindresorhus/debounce-fn#readme","_id":"debounce-fn@5.1.2","_nodeVersion":"14.19.2","_npmVersion":"8.3.2","dist":{"integrity":"sha512-Sr4SdOZ4vw6eQDvPYNxHogvrxmCIld/VenC5JbNrFwMiwd7lY/Z18ZFfo+EWNG4DD9nFlAujWAo/wGuOPHmy5A==","shasum":"c77bc447ef36828ecdd066df7de23f475e0a6281","tarball":"http://registry-npm.ywwl.com/debounce-fn/download/debounce-fn-5.1.2.tgz","fileCount":5,"unpackedSize":7489,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIG+7S4HWnYADrGkWoqfdvdtoKORMlDVDs9+u+H9Lyw5nAiEA4hJJh4OSiiQVBQXJgj+cW38tn/CBkVXYA0NHPHEwc8U="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJipC6FACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmowvxAAkSknW9cgz4VlPTj71/eXRWkRVFkKh0JQv5xN8EdgY+Q5REtQ\r\ngEdwx11uLJXf6CSImpMwxsgnrcf8I5VeJ9ojRbGN4oYIwf4grKuw2768m84w\r\neKHu/P5vlVrtv+A9KCMZiSNhZlvmZCz7kVxfvRyIP83KR+jaUOLG4LSn0AfS\r\nAPmTBeaj8t/x3SvfqEJUKc4+KCI/6LeA3uSBsSXkC0eoZFmND2PxyZUXuSYZ\r\nQsRzbwUOIX/xS3aaL62pmEN8sUJUOka1+NS/I9rXOLroi7li1EhjA5Uq8hJP\r\nhJwQSoFk2F2fhdJ0kh92dzyUrjTpO6nIZMj+V+ra1bMJ1OXWGIztcXusLvwI\r\n5l93RcoPUfeKeDHOpE0GjkqwDMgcJiGxM1hToYtG1TM0V/GMb0RV7SBaFrq+\r\nwnWW+XcjqbSG/QAw9Lcb3mnvN3kbiWaECQhpzUBSn7gf8Z8GZ8OvmCvrkxME\r\nkf6LlCVOrKKM4iNQlJUuxH9rS823WnnZE0GVdoCPMGFqZiDTr8BYzmeseUhN\r\nqDXCtIv0SittQx2kMlzE1GO8Q6Lsauw1XPJ/rp5ugcDOpXBXHpCc0yz7+3Vs\r\ni2H6YVJrUDVgzMTKHDLSBqflskFw+fY7qAfDOqAaTgLX5pjK2kwjBCcjIbDX\r\nblocc2kmXF4mZzL5UPq6Lw4WZEglQgJAHtM=\r\n=EtDM\r\n-----END PGP SIGNATURE-----\r\n","size":2787,"noattachment":false,"key":"/debounce-fn/-/debounce-fn-5.1.2.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/debounce-fn_5.1.2_1654926981745_0.22005986390442622"},"_hasShrinkwrap":false,"readme":"# debounce-fn\n\n> [Debounce](https://davidwalsh.name/javascript-debounce-function) a function\n\n## Install\n\n```sh\nnpm install debounce-fn\n```\n\n## Usage\n\n```js\nimport debounceFunction from 'debounce-fn';\n\nwindow.onresize = debounceFunction(() => {\n\t// Do something on window resize\n}, {wait: 100});\n```\n\n## API\n\n### debounceFunction(input, options?)\n\nReturns a debounced function that delays calling the `input` function until after `wait` milliseconds have elapsed since the last time the debounced function was called.\n\nIt comes with a `.cancel()` method to cancel any scheduled `input` function calls.\n\n#### input\n\nType: `Function`\n\nFunction to debounce.\n\n#### options\n\nType: `object`\n\n##### wait\n\nType: `number`\\\nDefault: `0`\n\nTime in milliseconds to wait until the `input` function is called.\n\n##### maxWait\n\nType: `number`\\\nDefault: `Infinity`\n\nThe maximum time the `input` function is allowed to be delayed before it's invoked.\n\nThis can be used to limit the number of calls handled in a constant stream. For example, a media player sending updates every few milliseconds but wants to be handled only once a second.\n\n##### before\n\nType: `boolean`\\\nDefault: `false`\n\nTrigger the function on the leading edge of the `wait` interval.\n\nFor example, can be useful for preventing accidental double-clicks on a \"submit\" button from firing a second time.\n\n##### after\n\nType: `boolean`\\\nDefault: `true`\n\nTrigger the function on the trailing edge of the `wait` interval.\n\n## Related\n\n- [p-debounce](https://github.com/sindresorhus/p-debounce) - Debounce promise-returning & async functions\n","publish_time":1654926981942,"_cnpm_publish_time":1654926981942,"dist-tags":{"latest":"7.0.0"}}