{"name":"debounce-fn","version":"5.1.1","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":"844be5176156019ffcc552c2c75997c7442a1ba1","bugs":{"url":"https://github.com/sindresorhus/debounce-fn/issues"},"homepage":"https://github.com/sindresorhus/debounce-fn#readme","_id":"debounce-fn@5.1.1","_nodeVersion":"14.19.2","_npmVersion":"8.3.2","dist":{"integrity":"sha512-M4WuURzp2OJ08D+M2I70HBBE9iGR1N1ACitF3MmN+33LwJ+wQjRCqVEL2VHlCU0wd+F/NQ1KIm8UKl9GoEzhow==","shasum":"077d78adaef6b091d222a3490a2d0953f2b7fc3b","tarball":"http://registry-npm.ywwl.com/debounce-fn/download/debounce-fn-5.1.1.tgz","fileCount":5,"unpackedSize":7480,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDn3wowkv/M0VHFZx4RaKINNNsnhiwFt4HZHyjtOI0/zgIgUb3Je6PrFB8nAspVfHnbIrbluqN4jvrbJ6Z/tAihyK4="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJipBpMACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmogtBAAoCXQKNXlA9Q33kczohufU4Ej9ptEQOgflZm09ZTOpVU6LkVb\r\na2pfz9fA9TXbtaPzPk9ZYCA0m80sDtfd6ArpAJ6vLSAdrgy9ek2xuaE1Fl9H\r\nfEWky8F4V6jcD8Ykwhy/1+Lp1JHJjvE9mNIsx41bVT3aZq6TU+DOrlc53Xm6\r\nyXTGXaxVqGy6u9s9nGvfzbwCdDsJWEy3ywjb+38xkyTLsrzgt6HhGtz7lWB3\r\nQKTRGo6FfXe93+5zeHLQUgSLgzONUhCKnNjC4ZJ5aqvVHpZeIyXoT6zt5+fT\r\ntcL8rmSQhks+pth4w9mbHg0AwTgcizveQ/ssx00AIbXqrgTey/sa87Wb2xy+\r\nZ/HWWGdSf/gbfR9Vy9u5ZnANkTMb1GvI9Ih8nS0gCqGekvbASWx7Mz0UjOFt\r\n1xaM1q+dQDOaBvYBqoUpfqzFQLgKCWNvozYbbZ7hh0Uz2znYsZosJYEeYY/i\r\nGT5neccG7YRjoYNz5dTwqbaAnON6otJZyT2VAN+SmtPieD5Nw65zv8COLxXy\r\nBYidtLrFv4QYtAcz8hS19fzGmuTmgW3FdUXhIesk7qVeIxwuEccCnJABZJZP\r\nxjK179w4TK91YXLFcwdPLRJSOLvKl9Jm/FKTjLgIhYYI1jJwtfexTNCEVDtn\r\ndti7B3qavz9wcN01GxZcLC177yVB7L2fdEw=\r\n=57jN\r\n-----END PGP SIGNATURE-----\r\n","size":2790,"noattachment":false,"key":"/debounce-fn/-/debounce-fn-5.1.1.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.1_1654921804211_0.8433754749757287"},"_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":1654921804389,"_cnpm_publish_time":1654921804389,"dist-tags":{"latest":"7.0.0"}}