{"_id":"@aakashx2838/use-timer","_rev":"2-210fdf537aa1ca360cb1f0d47b6cf4b8","name":"@aakashx2838/use-timer","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@aakashx2838/use-timer","private":false,"version":"1.0.0","license":"MIT","type":"module","main":"dist/index.umd.js","module":"dist/index.umd.js","types":"dist/index.d.ts","exports":{".":{"import":"./dist/index.es.js","require":"./dist/index.umd.js"}},"publishConfig":{"access":"public"},"scripts":{"dev":"vite","build":"tsc && vite build","lint":"eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0","prepare":"npm run build","preview":"vite preview"},"dependencies":{"react":"^18.2.0","react-dom":"^18.2.0"},"devDependencies":{"@types/node":"^20.4.7","@types/react":"^18.2.15","@types/react-dom":"^18.2.7","@typescript-eslint/eslint-plugin":"^6.0.0","@typescript-eslint/parser":"^6.0.0","@vitejs/plugin-react-swc":"^3.3.2","eslint":"^8.45.0","eslint-plugin-react-hooks":"^4.6.0","eslint-plugin-react-refresh":"^0.4.3","typescript":"^5.0.2","vite":"^4.4.5","vite-plugin-dts":"^3.5.0"},"keywords":["timer","react","nextjs","use-timer","react-hook","react-hooks","hook","hooks"],"repository":{"type":"git","url":"git+https://github.com/Aakashx2838/use-timer.git"},"author":{"name":"Aakash Acharya"},"bugs":{"url":"https://github.com/Aakashx2838/use-timer/issues"},"homepage":"https://github.com/Aakashx2838/use-timer#readme","gitHead":"6df2289f8283fc1edd9b32f6c4a5941750aa94ec","description":"A simple React timer hook.","_id":"@aakashx2838/use-timer@1.0.0","_nodeVersion":"18.15.0","_npmVersion":"9.6.2","dist":{"integrity":"sha512-lYcK56N95zFpSkyq/CDMuphYP/orUppTXaAppPzuH0h1FPpcvP5Hc8Alx1rgwQRpBOyrzCg9Dqm+MP0oudyKJA==","shasum":"a8a57466f82baa724f3130bd60143f189bf61a89","tarball":"https://registry.npmjs.org/@aakashx2838/use-timer/-/use-timer-1.0.0.tgz","fileCount":11,"unpackedSize":20904,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCYlumL2T1jU+VsX2tN4swWxxDbXSBb/i9qqtRrkTVY5AIhAJd1u9Uy5zcyJ+fqGcplGKMnNIxBBsQ8bLHSm4MvtQNb"}]},"_npmUser":{"name":"aakashx2838","email":"meaakash000@gmail.com"},"directories":{},"maintainers":[{"name":"aakashx2838","email":"meaakash000@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-timer_1.0.0_1691225590327_0.7556407049389413"},"_hasShrinkwrap":false},"1.0.1":{"name":"@aakashx2838/use-timer","private":false,"version":"1.0.1","license":"MIT","type":"module","main":"dist/react-use-timer.umd.js","module":"dist/react-use-timer.umd.js","types":"dist/index.d.ts","exports":{".":{"import":"./dist/react-use-timer.es.js","require":"./dist/react-use-timer.umd.js"}},"publishConfig":{"access":"public"},"scripts":{"dev":"vite","build":"tsc && vite build","lint":"eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0","prepare":"npm run build","preview":"vite preview"},"dependencies":{"react":"^18.2.0","react-dom":"^18.2.0"},"devDependencies":{"@types/node":"^20.4.7","@types/react":"^18.2.15","@types/react-dom":"^18.2.7","@typescript-eslint/eslint-plugin":"^6.0.0","@typescript-eslint/parser":"^6.0.0","@vitejs/plugin-react-swc":"^3.3.2","eslint":"^8.45.0","eslint-plugin-react-hooks":"^4.6.0","eslint-plugin-react-refresh":"^0.4.3","typescript":"^5.0.2","vite":"^4.4.5","vite-plugin-dts":"^3.5.0"},"keywords":["timer","react","nextjs","use-timer","react-hook","react-hooks","hook","hooks"],"repository":{"type":"git","url":"git+https://github.com/Aakashx2838/use-timer.git"},"author":{"name":"Aakash Acharya"},"bugs":{"url":"https://github.com/Aakashx2838/use-timer/issues"},"homepage":"https://github.com/Aakashx2838/use-timer#readme","gitHead":"6df2289f8283fc1edd9b32f6c4a5941750aa94ec","description":"A simple React timer hook.","_id":"@aakashx2838/use-timer@1.0.1","_nodeVersion":"18.15.0","_npmVersion":"9.6.2","dist":{"integrity":"sha512-COgHwTIaJaVb9YQYe7dU3qA6D3NTlrtJnZP3zTDdj9wbFk9fMoJ0XegUQa2c2SmSB21h52ubqQPmsMNecw55Vw==","shasum":"c8af5173d8c10d07950928107a892998e49f2398","tarball":"https://registry.npmjs.org/@aakashx2838/use-timer/-/use-timer-1.0.1.tgz","fileCount":11,"unpackedSize":20944,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCly/kkBWJwoIu5FIomVgR58/qxlQutDtVJvKx74NuWYgIgKIWeyI06JdSZZv+6QM2eiqRVmVw7dOOfD6JO1/hUbFc="}]},"_npmUser":{"name":"aakashx2838","email":"meaakash000@gmail.com"},"directories":{},"maintainers":[{"name":"aakashx2838","email":"meaakash000@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-timer_1.0.1_1691226095080_0.5230270936937951"},"_hasShrinkwrap":false},"1.0.2":{"name":"@aakashx2838/use-timer","private":false,"version":"1.0.2","license":"MIT","type":"module","main":"dist/react-use-timer.umd.js","module":"dist/react-use-timer.umd.js","types":"dist/index.d.ts","exports":{".":{"import":"./dist/react-use-timer.es.js","require":"./dist/react-use-timer.umd.js","types":"./dist/index.d.ts"}},"publishConfig":{"access":"public"},"scripts":{"dev":"vite","build":"tsc && vite build","lint":"eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0","prepare":"npm run build","preview":"vite preview"},"dependencies":{"react":"^18.2.0","react-dom":"^18.2.0"},"devDependencies":{"@types/node":"^20.4.7","@types/react":"^18.2.15","@types/react-dom":"^18.2.7","@typescript-eslint/eslint-plugin":"^6.0.0","@typescript-eslint/parser":"^6.0.0","@vitejs/plugin-react-swc":"^3.3.2","eslint":"^8.45.0","eslint-plugin-react-hooks":"^4.6.0","eslint-plugin-react-refresh":"^0.4.3","typescript":"^5.0.2","vite":"^4.4.5","vite-plugin-dts":"^3.5.0"},"keywords":["timer","react","nextjs","use-timer","react-hook","react-hooks","hook","hooks"],"repository":{"type":"git","url":"git+https://github.com/Aakashx2838/use-timer.git"},"author":{"name":"Aakash Acharya"},"bugs":{"url":"https://github.com/Aakashx2838/use-timer/issues"},"homepage":"https://github.com/Aakashx2838/use-timer#readme","gitHead":"6df2289f8283fc1edd9b32f6c4a5941750aa94ec","description":"A simple React timer hook.","_id":"@aakashx2838/use-timer@1.0.2","_nodeVersion":"18.15.0","_npmVersion":"9.6.2","dist":{"integrity":"sha512-NwEWrQnxg3uMS8INYQCtN6OA2ePTNJ4q3DC1cMODq+DAo5xyYCrPkqfVBrntE8jG+QlX7h2WHDA9Jj/jxs9Sqg==","shasum":"9134dae2e825d4070c063e7bfb2d2a9000ffb2b1","tarball":"https://registry.npmjs.org/@aakashx2838/use-timer/-/use-timer-1.0.2.tgz","fileCount":11,"unpackedSize":20980,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDalxCRMhFCiB0L5tezM97WENFKlzNQJWs0AJUNY3W7IQIhANanEWKIjziLwKMhv5TmWC5P/Z1wumVegOtncFXAgIft"}]},"_npmUser":{"name":"aakashx2838","email":"meaakash000@gmail.com"},"directories":{},"maintainers":[{"name":"aakashx2838","email":"meaakash000@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-timer_1.0.2_1691226295464_0.4500126662753603"},"_hasShrinkwrap":false}},"time":{"created":"2023-08-05T08:53:10.250Z","1.0.0":"2023-08-05T08:53:10.473Z","modified":"2023-08-05T09:04:55.806Z","1.0.1":"2023-08-05T09:01:35.295Z","1.0.2":"2023-08-05T09:04:55.672Z"},"maintainers":[{"name":"aakashx2838","email":"meaakash000@gmail.com"}],"description":"A simple React timer hook.","homepage":"https://github.com/Aakashx2838/use-timer#readme","keywords":["timer","react","nextjs","use-timer","react-hook","react-hooks","hook","hooks"],"repository":{"type":"git","url":"git+https://github.com/Aakashx2838/use-timer.git"},"author":{"name":"Aakash Acharya"},"bugs":{"url":"https://github.com/Aakashx2838/use-timer/issues"},"license":"MIT","readme":"# Use Debounce\r\n\r\nA simple React timer hook.\r\n\r\n## Installation\r\n\r\n```bash\r\nnpm install @aakashx2838/use-timer\r\n\r\n# or\r\n\r\nyarn add @aakashx2838/use-timer\r\n```\r\n\r\n## Usage\r\n\r\n```js\r\nimport { useTimer } from \"./use-timer\";\r\n\r\nfunction App() {\r\n  const { time, isRunning, toggle, reset } = useTimer({\r\n    reverse: true,\r\n    targetTime: -5,\r\n    loop: true,\r\n  });\r\n\r\n  return (\r\n    <>\r\n      <p>\r\n        {time.h}: {time.m}: {time.s}\r\n      </p>\r\n      <button onClick={toggle}>{isRunning ? \"Stop\" : \"Start\"}</button>\r\n      <button onClick={reset}>Reset</button>\r\n    </>\r\n  );\r\n}\r\n\r\nexport default App;\r\n```\r\n\r\n## Defaults\r\n\r\n```js\r\nlet step = 1; // in seconds\r\nlet timeInterval = 1; // in seconds\r\nlet startTime = 0; // in seconds\r\nlet targetTime = 0; // in seconds\r\nlet reverse = false; // in seconds\r\nlet loop = false; // in seconds\r\n\r\nlet onComplete = () => {};\r\nlet onStart = () => {};\r\nlet onPause = () => {};\r\nlet onTimeUpdate = (time: number) => {};\r\n```\r\n\r\n## Options\r\n\r\n| Option       | Type     | Description                                                                                    |\r\n| ------------ | -------- | ---------------------------------------------------------------------------------------------- |\r\n| step         | number   | The amount of time to increment/decrement the timer by.                                        |\r\n| timeInterval | number   | The interval at which the timer updates.                                                       |\r\n| startTime    | number   | The time at which the timer should start.                                                      |\r\n| targetTime   | number   | The time at which the timer should stop (Only provide if reverse is true).                     |\r\n| reverse      | boolean  | If true, the timer will count down. If false, the timer will count up.                         |\r\n| loop         | boolean  | If true, the timer will restart when it reaches the target time.                               |\r\n| onComplete   | function | A callback function that will be called when the timer reaches the target time.                |\r\n| onStart      | function | A callback function that will be called when the timer starts.                                 |\r\n| onPause      | function | A callback function that will be called when the timer is paused.                              |\r\n| onTimeUpdate | function | A callback function that will be called when the timer updates. The current time is passed in. |\r\n\r\n## Structure of time\r\n\r\n```js\r\n{\r\n  h: number;\r\n  m: number;\r\n  s: number;\r\n}\r\n```\r\n","readmeFilename":"README.md"}