{"name":"dettle","repository":{"type":"git","url":"git+https://github.com/fabiospampinato/dettle.git"},"description":"A tiny fully-featured debounce and throttle implementation.","version":"1.0.4","type":"module","main":"dist/index.js","exports":"./dist/index.js","types":"./dist/index.d.ts","scripts":{"clean":"tsex clean","compile":"tsex compile","compile:watch":"tsex compile --watch","test":"tsex test","test:watch":"tsex test --watch","prepublishOnly":"tsex prepare"},"keywords":["tiny","debounce","throttle"],"devDependencies":{"fava":"^0.3.4","tsex":"^4.0.2","typescript":"^5.5.2"},"_id":"dettle@1.0.4","gitHead":"0bcc649488cf04330b1effa973b4f3e2a86271fa","bugs":{"url":"https://github.com/fabiospampinato/dettle/issues"},"homepage":"https://github.com/fabiospampinato/dettle#readme","_nodeVersion":"18.19.0","_npmVersion":"10.2.3","dist":{"integrity":"sha512-ktaWiLYYc/ajSa819+HxwABpqtk3dGIAmo5CbHvT3B6XyQSM7VNGDvCPNu94Ptc+Ti4tjTvAKRUCXU/lrVG4WQ==","shasum":"218679cb569a5e507e61c7ad53989fc2a0bc8bb5","tarball":"http://registry-npm.ywwl.com/dettle/download/dettle-1.0.4.tgz","fileCount":18,"unpackedSize":13480,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCW5VFLfN3SrgrGqdkFWLwNoXY3AbxttYbm8lApjYe4MgIgbwTEcf4FBS+U7l+HBBe3dIY2KRv6wIWzRGaEeDAxapg="}],"size":4050,"noattachment":false,"key":"/dettle/-/dettle-1.0.4.tgz"},"_npmUser":{"name":"fabiospampinato","email":"spampinabio@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/dettle_1.0.4_1719764047150_0.1232983450287044"},"_hasShrinkwrap":false,"readme":"# Dettle\n\nA tiny fully-featured debounce and throttle implementation.\n\n## Install\n\n```sh\nnpm install --save dettle\n```\n\n## Usage\n\n```ts\nimport {debounce, throttle} from 'dettle';\n\nconst fn = () => console.log ( 'Fired!' );\n\n// Debouncing\n// The following options are supported:\n// `leading`: whether the function should be called when the timeout is created, defaults to `false`\n// `trailing`: whether the function should be called when the timeout expires, defaults to `true`\n// `maxWait`: the maximum amount of time that can pass before the function is called, defaults to `Infinity`\n\nconst debounced = debounce ( fn, 1000, {\n  leading: false,\n  trailing: true,\n  maxWait: Infinity\n});\n\ndebounced (); // Schedule function for execution\ndebounced (); // Re-schedule function for execution\n\ndebounced.flush (); // Execute the function immediately, if there's a scheduled execution\ndebounced.cancel (); // Cancel the scheduled execution\n\n// Throttling\n// The API for throttling is basically the same, except that:\n// - `leading`: is `true` by default rather than `false`\n// - `maxWait`: is set implicitly for you to be equal to the wait time\n\nconst throttled = throttle ( fn, 1000, {\n  leading: true,\n  trailing: true\n});\n\nthrottled (); // Call the function immediately\nthrottled (); // Schedule function for execution\n\nthrottled.flush (); // Execute the function immediately, if there's a scheduled execution\nthrottled.cancel (); // Cancel the scheduled execution\n```\n\n## License\n\nMIT © Fabio Spampinato\n","publish_time":1719764047287,"maintainers":[{"name":"fabiospampinato","email":"spampinabio@gmail.com"}],"_cnpm_publish_time":1719764047287,"dist-tags":{"latest":"1.0.5"}}