{"name":"debounce-fn","version":"2.0.0","description":"","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"author":"","license":"ISC","_id":"debounce-fn@2.0.0","_shasum":"b0458a4699c4bb15a89242aadb6f90367df37238","_from":".","_npmVersion":"3.7.2","_nodeVersion":"4.3.0","_npmUser":{"name":"nj48","email":"spam@njohnson.me"},"dist":{"shasum":"b0458a4699c4bb15a89242aadb6f90367df37238","tarball":"http://registry-npm.ywwl.com/debounce-fn/download/debounce-fn-2.0.0.tgz","integrity":"sha512-5YPjbRRXR3NqpkNyA1v/ziRPNWzCSGaxipFeER01/iNuGtFO3Ey1xIMFoXfSYz6kaUTuDJgTWiTIp4Sukqj+9w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD7U6iDP64q51V98+Gnm1RIqJv2LY2UkjFL312xzkhPYgIgAUt9Z9LC8FB8VZPldT3D8I8zEXUSKF3LWQE90EWmHo4="}],"size":1869,"noattachment":false,"key":"/debounce-fn/-/debounce-fn-2.0.0.tgz"},"maintainers":[{"name":"nj48","email":"spam@njohnson.me"}],"directories":{},"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":1458690429961,"_cnpm_publish_time":1458690429961,"dist-tags":{"latest":"7.0.0"}}