{"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.2","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.2.0","tsex":"^3.0.0","typescript":"^5.1.6"},"_id":"dettle@1.0.2","gitHead":"26a75367c385213be33d9a6163f3afc6359e2d94","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-pIVcNUx2/R7P45l3wEUsyrZcfbVUCKBmctUN41syh2asCXmrRndJEiNng9+8socNOAEBiBRqsQCh3HhCkOFwwg==","shasum":"d0f772ca718709e1cc60335aa54362313527235c","tarball":"http://registry-npm.ywwl.com/dettle/download/dettle-1.0.2.tgz","fileCount":18,"unpackedSize":13107,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDRJ8O1GuRSthQSYzosMzPv5at7ZtR0LypIJHUGfprsaQIgX/1Y759Y3B+eLDtPkzQpIlcrurYv8hCSHj6HR6PBdpM="}],"size":3947,"noattachment":false,"key":"/dettle/-/dettle-1.0.2.tgz"},"_npmUser":{"name":"fabiospampinato","email":"spampinabio@gmail.com"},"directories":{},"maintainers":[{"name":"fabiospampinato","email":"spampinabio@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/dettle_1.0.2_1712270076751_0.8126230395162888"},"_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\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## License\n\nMIT © Fabio Spampinato\n","publish_time":1712270076985,"_cnpm_publish_time":1712270076985,"dist-tags":{"latest":"1.0.5"}}