{"_id":"@benjaming61001/use-debounce","_rev":"7-4ea5eaa14ed76526af6b972bb0a9bafc","name":"@benjaming61001/use-debounce","dist-tags":{"latest":"1.2.1"},"versions":{"1.0.0":{"name":"@benjaming61001/use-debounce","version":"1.0.0","keywords":[],"author":"","license":"MIT","_id":"@benjaming61001/use-debounce@1.0.0","maintainers":[{"name":"benjaming61001","email":"pavin5356@gmail.com"}],"homepage":"https://github.com/Benjaming61001/use-debounce#readme","bugs":{"url":"https://github.com/Benjaming61001/use-debounce/issues"},"dist":{"shasum":"5e7cf807b0202ee10162460bc7064027e5099c4a","tarball":"https://registry.npmjs.org/@benjaming61001/use-debounce/-/use-debounce-1.0.0.tgz","fileCount":7,"integrity":"sha512-Jq+UT0z1joDgsLw6HJTuTiP5qRyyou3qNxuFhku0/ufKCT+HU77Y3BeoaUoAT/vncYu+jsC39oHCY188vPjqrw==","signatures":[{"sig":"MEUCIDVvbg7PKRX4rO5F6pCy0btZLfibG67WugbQwUjipmLEAiEA+Ja7etXtegYMU4yLjq2OZI2gZJ9rK5eia2dUwbFGu1U=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":5579},"main":"index.js","types":"dist/index.d.ts","module":"dist/index.mjs","gitHead":"0339a182c5e88e4e088ffd8b50affec58737da21","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"tsup src/index.ts --format cjs,esm --dts","prepublishOnly":"npm run build"},"_npmUser":{"name":"benjaming61001","email":"pavin5356@gmail.com"},"repository":{"url":"git+https://github.com/Benjaming61001/use-debounce.git","type":"git"},"_npmVersion":"10.9.2","description":"A lightweight TypeScript debounce function implementation that fires on the trailing edge, preserving this context and parameters. Ideal for user input events.","directories":{},"_nodeVersion":"22.16.0","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.0","typescript":"^5.9.3"},"_npmOperationalInternal":{"tmp":"tmp/use-debounce_1.0.0_1762802307791_0.33731531687213856","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@benjaming61001/use-debounce","version":"1.0.1","keywords":[],"author":"","license":"MIT","_id":"@benjaming61001/use-debounce@1.0.1","maintainers":[{"name":"benjaming61001","email":"pavin5356@gmail.com"}],"homepage":"https://github.com/Benjaming61001/use-debounce#readme","bugs":{"url":"https://github.com/Benjaming61001/use-debounce/issues"},"dist":{"shasum":"19caff830b4c5737857ec0990854217764ddd7de","tarball":"https://registry.npmjs.org/@benjaming61001/use-debounce/-/use-debounce-1.0.1.tgz","fileCount":7,"integrity":"sha512-9IjgDlzFC/7Jt990yxy1Z4FB1Pm/ovxf2dER3nqB+83BzsXPz517Z4kI2ttWh7oNXDhx9WEksJeUqlXwZC7tGw==","signatures":[{"sig":"MEQCIGMswfIv1R4l6QNaCYkPAmZVL7Ztwdbn6jo86hufqNLXAiB89XbJSDiiesaq3LfqNb052IbIKrpXwZiNsFSR6fsV0g==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":5570},"main":"index.js","types":"dist/index.d.ts","module":"dist/index.mjs","gitHead":"2d431415134ff004b8a75d31c890397c410d2464","scripts":{"test":"echo \"Error: no test specified\"","build":"tsup src/index.ts --format cjs,esm --dts","prepublishOnly":"npm run build"},"_npmUser":{"name":"benjaming61001","email":"pavin5356@gmail.com"},"repository":{"url":"git+https://github.com/Benjaming61001/use-debounce.git","type":"git"},"_npmVersion":"11.6.2","description":"A lightweight TypeScript debounce function implementation that fires on the trailing edge, preserving this context and parameters. Ideal for user input events.","directories":{},"_nodeVersion":"24.11.1","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.0","typescript":"^5.9.3"},"_npmOperationalInternal":{"tmp":"tmp/use-debounce_1.0.1_1763564093388_0.9758900282283367","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@benjaming61001/use-debounce","version":"1.1.0","keywords":[],"author":"","license":"MIT","_id":"@benjaming61001/use-debounce@1.1.0","maintainers":[{"name":"benjaming61001","email":"pavin5356@gmail.com"}],"homepage":"https://github.com/Benjaming61001/use-debounce#readme","bugs":{"url":"https://github.com/Benjaming61001/use-debounce/issues"},"dist":{"shasum":"1224b3fd78c96fe72e0aa7511fa0e74f0962056b","tarball":"https://registry.npmjs.org/@benjaming61001/use-debounce/-/use-debounce-1.1.0.tgz","fileCount":7,"integrity":"sha512-xoMD4Gl84QJjBVWp1pv6r/oDrDPAXThYFn+LN3b6Vfb0PnfdJ68uysO/G/BR0X8bOJeXllRcw5WcHVJZ6aM+og==","signatures":[{"sig":"MEYCIQDJZGCErjWz7mTD6xnVhDtW/zlQ/T1qTcesScSy7mSW3QIhAPpXsiciLuKYqw2PYWx3N0I7EkWnCHtn32LOJgOM+bRG","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":6696},"main":"index.js","types":"dist/index.d.ts","module":"dist/index.mjs","gitHead":"b606a0fef6acf578570dc3bde243f88063be5909","scripts":{"test":"echo \"Error: no test specified\"","build":"tsup src/index.ts --format cjs,esm --dts","prepublishOnly":"npm run build"},"_npmUser":{"name":"benjaming61001","email":"pavin5356@gmail.com"},"repository":{"url":"git+https://github.com/Benjaming61001/use-debounce.git","type":"git"},"_npmVersion":"10.9.2","description":"A lightweight TypeScript debounce function implementation that fires on the trailing edge, preserving this context and parameters. Ideal for user input events.","directories":{},"_nodeVersion":"22.16.0","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.0","typescript":"^5.9.3"},"_npmOperationalInternal":{"tmp":"tmp/use-debounce_1.1.0_1768334401245_0.49835279553771517","host":"s3://npm-registry-packages-npm-production"}},"1.1.1":{"name":"@benjaming61001/use-debounce","version":"1.1.1","keywords":[],"author":"","license":"MIT","_id":"@benjaming61001/use-debounce@1.1.1","maintainers":[{"name":"benjaming61001","email":"pavin5356@gmail.com"}],"homepage":"https://github.com/Benjaming61001/use-debounce#readme","bugs":{"url":"https://github.com/Benjaming61001/use-debounce/issues"},"dist":{"shasum":"3f992d257225ac434e3add797565901c304526ce","tarball":"https://registry.npmjs.org/@benjaming61001/use-debounce/-/use-debounce-1.1.1.tgz","fileCount":7,"integrity":"sha512-o4YFNy/nKrQAajG0zCMDTaHzVl3NC9Lo/hzpFJ2MRiTESajDLDf5566nAyMRSvOBKi7vYhSVhvaq0tjeY42wMA==","signatures":[{"sig":"MEQCIHDM/YPTVq+QCeeqX1SvtwWUKUeWBtjSEoPch7UgTNigAiAlspAHuqg9Otb0SjDrda6rAyzlmujFQVh5L6yqPUQeuQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@benjaming61001%2fuse-debounce@1.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":6696},"main":"index.js","types":"dist/index.d.ts","module":"dist/index.mjs","gitHead":"d95d38e52c5d59a2bdb73839fa54168352e36d50","scripts":{"test":"echo \"Error: no test specified\"","build":"tsup src/index.ts --format cjs,esm --dts","prepublishOnly":"npm run build"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:fed955e7-72b1-4e4b-857d-ab87aa92fd50"}},"repository":{"url":"git+https://github.com/Benjaming61001/use-debounce.git","type":"git"},"_npmVersion":"11.9.0","description":"A lightweight TypeScript debounce function implementation that fires on the trailing edge, preserving this context and parameters. Ideal for user input events.","directories":{},"_nodeVersion":"24.14.0","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.0","typescript":"^5.9.3"},"_npmOperationalInternal":{"tmp":"tmp/use-debounce_1.1.1_1772998210134_0.7645334976047204","host":"s3://npm-registry-packages-npm-production"}},"1.1.2":{"name":"@benjaming61001/use-debounce","version":"1.1.2","keywords":[],"author":"","license":"MIT","_id":"@benjaming61001/use-debounce@1.1.2","maintainers":[{"name":"benjaming61001","email":"pavin5356@gmail.com"}],"homepage":"https://github.com/Benjaming61001/use-debounce#readme","bugs":{"url":"https://github.com/Benjaming61001/use-debounce/issues"},"dist":{"shasum":"34048d67399bb49ea8c4bd90a41b6e6974e4ab17","tarball":"https://registry.npmjs.org/@benjaming61001/use-debounce/-/use-debounce-1.1.2.tgz","fileCount":7,"integrity":"sha512-8zePiNJeZx+LdCpDbwNmy35reLbi1uV2cmc6X26oLMafo+iDafVgOB5IQrbZC8J6ka6XnGQtHI0DF5/Yn4XfAg==","signatures":[{"sig":"MEYCIQDM6DudrZV9Ym2Zh9GNNdp9r3QBD9Foo+Ff/GMKeyEyswIhAJ59nx3c8WlZ12sVbo6QajYrTauoi1m+mfUqds6lvOiE","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":6845},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"b606a0fef6acf578570dc3bde243f88063be5909","scripts":{"test":"echo \"Error: no test specified\"","build":"tsup src/index.ts --format cjs,esm --dts","prepublishOnly":"npm run build"},"_npmUser":{"name":"benjaming61001","email":"pavin5356@gmail.com"},"repository":{"url":"git+https://github.com/Benjaming61001/use-debounce.git","type":"git"},"_npmVersion":"11.13.0","description":"A lightweight TypeScript debounce function implementation that fires on the trailing edge, preserving this context and parameters. Ideal for user input events.","directories":{},"_nodeVersion":"24.16.0","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.0","typescript":"^5.9.3"},"_npmOperationalInternal":{"tmp":"tmp/use-debounce_1.1.2_1780898107468_0.029030718538366473","host":"s3://npm-registry-packages-npm-production"}},"1.2.0":{"name":"@benjaming61001/use-debounce","version":"1.2.0","keywords":["debounce","typescript","javascript","util","utility","performance","optimization","user-input","search","event-handler"],"author":"","license":"MIT","_id":"@benjaming61001/use-debounce@1.2.0","maintainers":[{"name":"benjaming61001","email":"pavin5356@gmail.com"}],"homepage":"https://github.com/Benjaming61001/use-debounce#readme","bugs":{"url":"https://github.com/Benjaming61001/use-debounce/issues"},"dist":{"shasum":"acbe579c8fe1c54d164fa5b07bf7b1e8cd0efec2","tarball":"https://registry.npmjs.org/@benjaming61001/use-debounce/-/use-debounce-1.2.0.tgz","fileCount":7,"integrity":"sha512-cQJj1Bgf0l5iT9oJ9sAuTU2IiFe5bm1rgDml8jJQFbyliVhfx7oBqiZ3GwmYIN/JIsmU5l7yZ9MnCBgtmXUr1g==","signatures":[{"sig":"MEUCIHrYPH6tjgkhQVyND4pjDyAPQiAQi2i/c7LAuH6mXrRZAiEAkTBnU4CgYd26SnMKJ1+BN7RUAKgeIpzYxWaFK+Mta00=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@benjaming61001%2fuse-debounce@1.2.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":7568},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"f723c5cd05b37eb9fdf84c61026e1243eaf7ac5e","scripts":{"lint":"oxlint src/","test":"vitest run","build":"tsup src/index.ts --format cjs,esm --dts","format":"oxfmt src/","lint:fix":"oxlint src/ --fix","format:fix":"oxfmt src/ --write","test:watch":"vitest","prepublishOnly":"npm run build"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:fed955e7-72b1-4e4b-857d-ab87aa92fd50"}},"repository":{"url":"git+https://github.com/Benjaming61001/use-debounce.git","type":"git"},"_npmVersion":"11.13.0","description":"A lightweight TypeScript debounce function implementation that fires on the trailing edge, preserving this context and parameters. Ideal for user input events.","directories":{},"_nodeVersion":"24.16.0","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.0","oxfmt":"^0.54.0","oxlint":"^1.69.0","vitest":"^4.1.8","typescript":"^5.9.3"},"_npmOperationalInternal":{"tmp":"tmp/use-debounce_1.2.0_1780995740661_0.4920175579191923","host":"s3://npm-registry-packages-npm-production"}},"1.2.1":{"name":"@benjaming61001/use-debounce","version":"1.2.1","description":"A lightweight TypeScript debounce function implementation that fires on the trailing edge, preserving this context and parameters. Ideal for user input events.","main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"scripts":{"build":"tsup src/index.ts --format cjs,esm --dts","prepublishOnly":"npm run build","test":"vitest run","test:watch":"vitest","lint":"oxlint src/","lint:fix":"oxlint src/ --fix","format":"oxfmt src/","format:fix":"oxfmt src/ --write"},"repository":{"type":"git","url":"git+https://github.com/Benjaming61001/use-debounce.git"},"keywords":["debounce","typescript","javascript","util","utility","performance","optimization","user-input","search","event-handler"],"author":"","license":"MIT","bugs":{"url":"https://github.com/Benjaming61001/use-debounce/issues"},"homepage":"https://github.com/Benjaming61001/use-debounce#readme","devDependencies":{"oxfmt":"^0.54.0","oxlint":"^1.69.0","tsup":"^8.5.0","typescript":"^5.9.3","vitest":"^4.1.8"},"gitHead":"9486cb77a08dd40784f8e1e81a57f6d5fa6e3c30","_id":"@benjaming61001/use-debounce@1.2.1","_nodeVersion":"24.16.0","_npmVersion":"11.13.0","dist":{"integrity":"sha512-gUnFOLV69KL2nSvJZcWwKeyQzh3Wk0BmRJwNDZ/Mg9d7rYJqJOop8KjcnNsdLHwcOstHS1PytZLOLY8a0jUoyg==","shasum":"12c7f4bd52b6d4b04a4f1c62eb63caa543ab168e","tarball":"https://registry.npmjs.org/@benjaming61001/use-debounce/-/use-debounce-1.2.1.tgz","fileCount":7,"unpackedSize":7568,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@benjaming61001%2fuse-debounce@1.2.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQC89JNNEkBydi6Mygvokm8pMfraJnERpJS5WgpjraUs9gIhAIcD34J6PjSHvc4bjYV5cVI4ptbntK5F5F+0QaZJXopN"}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:fed955e7-72b1-4e4b-857d-ab87aa92fd50"}},"directories":{},"maintainers":[{"name":"benjaming61001","email":"pavin5356@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/use-debounce_1.2.1_1780996459474_0.3818271446158217"},"_hasShrinkwrap":false}},"time":{"created":"2025-11-10T19:18:27.691Z","modified":"2026-06-09T09:14:19.858Z","1.0.0":"2025-11-10T19:18:27.996Z","1.0.1":"2025-11-19T14:54:53.575Z","1.1.0":"2026-01-13T20:00:01.395Z","1.1.1":"2026-03-08T19:30:10.284Z","1.1.2":"2026-06-08T05:55:07.608Z","1.2.0":"2026-06-09T09:02:20.828Z","1.2.1":"2026-06-09T09:14:19.601Z"},"bugs":{"url":"https://github.com/Benjaming61001/use-debounce/issues"},"license":"MIT","homepage":"https://github.com/Benjaming61001/use-debounce#readme","keywords":["debounce","typescript","javascript","util","utility","performance","optimization","user-input","search","event-handler"],"repository":{"type":"git","url":"git+https://github.com/Benjaming61001/use-debounce.git"},"description":"A lightweight TypeScript debounce function implementation that fires on the trailing edge, preserving this context and parameters. Ideal for user input events.","maintainers":[{"name":"benjaming61001","email":"pavin5356@gmail.com"}],"readme":"# use-debounce\n\nA lightweight TypeScript debounce function implementation that fires on the trailing edge, preserving `this` context and parameters. Ideal for user input events.\n\n## Installation\n\n```bash\nnpm install @benjaming61001/use-debounce\n```\n\n```bash\nbun add @benjaming61001/use-debounce\n```\n\n```bash\nyarn add @benjaming61001/use-debounce\n```\n\n```bash\npnpm add @benjaming61001/use-debounce\n```\n\n## Usage\n\n### Basic Usage\n\n```typescript\nimport { useDebounce } from '@benjaming61001/use-debounce'\n\nconst debouncedSearch = useDebounce((query: string) => {\n  fetchResults(query)\n}, 500)\n\ndebouncedSearch('hello')\n```\n\n### Cancel & Flush\n\n```typescript\nconst debouncedSave = useDebounce((data: FormData) => {\n  api.save(data)\n}, 1000)\n\n// Cancel pending execution\ndebouncedSave.cancel()\n\n// Flush pending execution immediately\ndebouncedSave.flush()\n```\n\n### Preserving Context\n\n```typescript\nclass SearchController {\n  query = ''\n\n  search = useDebounce((term: string) => {\n    console.log(this.query) // `this` is preserved\n    api.search(term)\n  }, 300)\n}\n```\n\n## API\n\n### `useDebounce(func, delay?)`\n\nCreates a debounced version of a function that delays its execution until after a specified `delay` milliseconds have passed since the last time it was invoked.\n\n| Parameter | Type | Default | Description |\n|-----------|------|---------|-------------|\n| `func` | `(...args: TArgs) => void` | required | The function to debounce |\n| `delay` | `number` | `1500` | Delay in milliseconds |\n\n**Returns:** A debounced function with `cancel()` and `flush()` methods.\n\n### `cancel()`\n\nCancels any pending debounced function execution.\n\n### `flush()`\n\nImmediately executes the debounced function if there's a pending call, then cancels any further pending execution.\n\n## Development\n\n```bash\nbun install\nbun run test        # run tests\nbun run test:watch  # watch mode\nbun run build       # build package\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md"}