{"_id":"dettle","_rev":"298412","name":"dettle","description":"A tiny fully-featured debounce and throttle implementation.","dist-tags":{"latest":"1.0.1"},"maintainers":[{"name":"fabiospampinato","email":""}],"time":{"modified":"2024-01-15T13:43:10.000Z","created":"2023-01-27T19:51:17.498Z","1.0.1":"2023-01-27T23:25:00.225Z","1.0.0":"2023-01-27T19:51:17.498Z"},"users":{},"repository":{"type":"git","url":"git+https://github.com/fabiospampinato/dettle.git"},"versions":{"1.0.1":{"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.1","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":"npm run clean && npm run compile && npm run test"},"keywords":["tiny","debounce","throttle"],"devDependencies":{"fava":"^0.0.7","tsex":"^1.1.4","typescript":"^4.9.4"},"gitHead":"d2475592c3e052fc932134c238a1c340a72b421e","bugs":{"url":"https://github.com/fabiospampinato/dettle/issues"},"homepage":"https://github.com/fabiospampinato/dettle#readme","_id":"dettle@1.0.1","_nodeVersion":"18.12.0","_npmVersion":"8.19.2","dist":{"shasum":"25e07a725722e389d3dea28027fb4a53cf18d8dd","size":4016,"noattachment":false,"key":"/dettle/-/dettle-1.0.1.tgz","tarball":"http://name.csiicloud.com:7001/dettle/download/dettle-1.0.1.tgz"},"_npmUser":{"name":"fabiospampinato","email":"spampinabio@gmail.com"},"directories":{},"maintainers":[{"name":"fabiospampinato","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/dettle_1.0.1_1674861900066_0.5553728704158427"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-01-27T23:25:00.225Z","publish_time":1674861900225,"_cnpm_publish_time":1674861900225},"1.0.0":{"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.0","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":"npm run clean && npm run compile && npm run test"},"keywords":["tiny","debounce","throttle"],"devDependencies":{"fava":"^0.0.7","tsex":"^1.1.4","typescript":"^4.9.4"},"bugs":{"url":"https://github.com/fabiospampinato/dettle/issues"},"homepage":"https://github.com/fabiospampinato/dettle#readme","_id":"dettle@1.0.0","_nodeVersion":"18.12.0","_npmVersion":"8.19.2","dist":{"shasum":"ae1019d0dce71623f36494d50b6490028f2186f1","size":3960,"noattachment":false,"key":"/dettle/-/dettle-1.0.0.tgz","tarball":"http://name.csiicloud.com:7001/dettle/download/dettle-1.0.0.tgz"},"_npmUser":{"name":"fabiospampinato","email":"spampinabio@gmail.com"},"directories":{},"maintainers":[{"name":"fabiospampinato","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/dettle_1.0.0_1674849077366_0.36311149847736934"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-01-27T19:51:17.498Z","publish_time":1674849077498,"_cnpm_publish_time":1674849077498}},"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\nconst debounced = debounce ( fn, 1000, {\n  leading: false,\n  maxWait: 3000\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// - `maxWait` is set implicitly for you to be equal to the wait time\n// - `leading` is `true` by default rather than `false`\n\nconst throttled = throttle ( fn, 1000 );\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\n## License\n\nMIT © Fabio Spampinato\n","_attachments":{},"homepage":"https://github.com/fabiospampinato/dettle#readme","bugs":{"url":"https://github.com/fabiospampinato/dettle/issues"}}