{"name":"debounce-fn","version":"5.0.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":"^3.0.0"},"devDependencies":{"ava":"^3.15.0","delay":"^4.2.0","tsd":"^0.14.0","xo":"^0.37.1"},"gitHead":"04f35600ea846984d19a335e366720fb21839903","bugs":{"url":"https://github.com/sindresorhus/debounce-fn/issues"},"homepage":"https://github.com/sindresorhus/debounce-fn#readme","_id":"debounce-fn@5.0.0","_nodeVersion":"14.15.1","_npmVersion":"6.14.10","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"integrity":"sha512-y0u25m4GMdDJ1oHX4ziszas15E4ryNoeFkQuZM/Z6yTy8jB8ity/jqSNWnQUi/csBBaQIad6Zd8eI1xKwtbFzw==","shasum":"1375e6b64a871e6fb6967c6ee05efbac08b65d9e","tarball":"http://registry-npm.ywwl.com/debounce-fn/download/debounce-fn-5.0.0.tgz","fileCount":5,"unpackedSize":7420,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgO2T1CRA9TVsSAnZWagAADQoP/j4etfBs2cF9jKDCQAlW\nF6NIUVuOuje72TP1jns4eQk+C7q3JBpkuvX1Ct5vLXiFlzllrFhWWreT+t5i\nMSQ1oI0ikbWFszc2TJbSGZbXbDXdet67AG2IUq8ZF87VnRohDc/9yb2n+Kpk\nsKkOGb5eA7Mgib6fn8WGFducMMgKUPQ5sTS7gsvDG/2awnySqeVg2LFyvzSj\nDzXTApu2d28SSE0I6F+gOJ7hSo1utyxd7B3XkV5JS8hhi35qyuFL9AhPrlGo\nVWbo0qkt0xbEMK4YHuOzy7UxBI11uBSjchCdglxu4YVt8oM1qIlH5o8sijlR\nxx7t0s4GUJuyqcKUlDmWAV+ejXbezeQgib98D3ZVHfyPMnir6obMKxVEgg+r\ntfSFmqJiY+HCpuCvA7//+9ph+1xdV2QTOIRNIZsLMlcHKVajbRnvw0I36rkI\njgekl7tRYWgppil2qoLV69IzKXovIkK1NTKg5GSXIzCxm3qEvDImQfL20Fcm\nLwhpXX/ARIGGENYR6o6930hQf1VYg+OedUgMArPVRHrVsmEvd4y5rpaOD3Z4\nD/MhL+EFQcZJWSX3CWZx8vuxbmjgIm+sF5nRqPH2sCy/eflh0M7HZuV9czi+\n365SCrk9RpfkXI46KqIKxE/gOHp70wLyUJ1XxhZxUuCWMaUX9b9mRG3gTTja\n6iM8\r\n=JnHn\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCXs6a2BhDO39zzooMyy2xXogfg8y/6ZeiYFjwFIyQV/AIgUfkkJzi2TuKgagha8RtnnL3Q1E7sOrdFttStm0bCOk8="}],"size":2755,"noattachment":false,"key":"/debounce-fn/-/debounce-fn-5.0.0.tgz"},"directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/debounce-fn_5.0.0_1614505205065_0.6374714720844945"},"_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":1614505205271,"_cnpm_publish_time":1614505205271,"dist-tags":{"latest":"7.0.0"}}