{"name":"debounce-fn","version":"5.1.0","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":"7234eb37aa74198dfca2ab49a889cb24555360dc","bugs":{"url":"https://github.com/sindresorhus/debounce-fn/issues"},"homepage":"https://github.com/sindresorhus/debounce-fn#readme","_id":"debounce-fn@5.1.0","_nodeVersion":"14.17.5","_npmVersion":"8.1.0","dist":{"integrity":"sha512-cVmH6CjQyBnlP3nD3OPJw/+Afvbm/XVEkRedSivSCCmRtJehXWrQyM6S8iorH7TrOikgmZ2hII6A1laSpfSuHQ==","shasum":"9b061aea201b3101cd05146863ed225159e3cda5","tarball":"http://registry-npm.ywwl.com/debounce-fn/download/debounce-fn-5.1.0.tgz","fileCount":5,"unpackedSize":7471,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh0FvuCRA9TVsSAnZWagAAOrAP/juQDoQxfMlS15PFnWyh\n4TbgiPi3tmle2Gy0UziTvkiVPzlgpf/XcnVmVj0EcyDgW/ZPASqeufb96VEz\nPAcEC98cTA20MhYZ29I8UCBbpYMqyHKoTcY9tqLHAMMZaN+eZDCFSSnIvB93\nVmTrVp9lIGvdwUiuMGpCRNo8htCrJcezVeJKNSpNjARwCR4eNhUd3cFh2U+A\nvDlfeSPtUgf02xyGEjZYZy91BrFApl56LQkCTIfxDhtQ7xRYB0/UCCNKmPDC\nH0FpqGj6hwF0UdwOepNMd9ubAV5i+Ra6LH6Jp+uxN+wugHE6wXp1740jLIGd\nNB8gzJTiUAGiFt7vZRH6vAinC95mbHx40+NpmVJacx/8aCjsxjCLKK9zvCDV\nndLlBdESaGg6xCinsPXgw/xTvYwy9ZTbq334FqlOKXFtgTVTeLoDxqXq+SmT\n1En8NQOv6gWmon2cqA3QpjdGKRXjPTHK3EiI3MkU3qo1m4G8BemEigs2DpKm\nqRPZ7DVJ449K4ztfEFZAPoNvjhiwd834+EH87SvbMTKBH1sJZ0UmHeE7MHS9\nQ+IryGyQ0o/GTsODgTia3iOPYn1fpNwhPdDMfJocgfEJtopgyTae7FQCyINg\nN+p3BqR2C+293BIx0O70YmXaKB0D2h8dmk5aKEpJkEVXR7xWqq8dawKj3Fvv\nMTJZ\r\n=5GDq\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD6BXmr/GEaRgfsu0KQ0sEi3cCcE8uYK7/ASxd+EhCkbQIhAP44yU230dOnoXek8of50qQfQ+R1hTDFLCUHuebxev5I"}],"size":2777,"noattachment":false,"key":"/debounce-fn/-/debounce-fn-5.1.0.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.0_1641044974480_0.9509755131901652"},"_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":1641044974644,"_cnpm_publish_time":1641044974644,"dist-tags":{"latest":"7.0.0"}}