Gathering detailed insights and metrics for use-timer
Gathering detailed insights and metrics for use-timer
Gathering detailed insights and metrics for use-timer
Gathering detailed insights and metrics for use-timer
react-use-precision-timer
A versatile precision timer hook for React. Doubles as a stopwatch.
@gabrielyotoo/react-use-timer
Hook for timer to React
@layerhub-io/use-timer
Simple timer using React Context API. Can be accesible from any component.
nanotimer
A much higher accuracy timer object that makes use of the node.js hrtime function call.
npm install use-timer
Typescript
Module System
Node Version
NPM Version
TypeScript (98.74%)
JavaScript (1.26%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
204 Stars
159 Commits
24 Forks
2 Watchers
9 Branches
8 Contributors
Updated on May 19, 2025
Latest Version
2.0.1
Package Id
use-timer@2.0.1
Unpacked Size
13.87 kB
Size
4.75 kB
File Count
16
NPM Version
6.14.4
Node Version
12.16.3
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Simple timer turned into React Hooks. Read about Hooks feature.
npm i use-timer
With Yarn:
yarn add use-timer
🚀 Try last production version on Netlify!
https://use-timer.netlify.app/
1import React from 'react'; 2import { useTimer } from 'use-timer'; 3 4const App = () => { 5 const { time, start, pause, reset, status } = useTimer(); 6 7 return ( 8 <> 9 <div> 10 <button onClick={start}>Start</button> 11 <button onClick={pause}>Pause</button> 12 <button onClick={reset}>Reset</button> 13 </div> 14 <p>Elapsed time: {time}</p> 15 {status === 'RUNNING' && <p>Running...</p>} 16 </> 17 ); 18};
1const { time, start, pause, reset, status } = useTimer({ 2 initialTime: 100, 3 timerType: 'DECREMENTAL', 4});
1const { time, start, pause, reset, status } = useTimer({ 2 endTime: 30, 3 initialTime: 10, 4});
This works for all types of timer (incremental and decremental).
1const { time, start, advanceTime } = useTimer({ 2 initialTime: 20, 3}); 4 5start(); 6advanceTime(10); 7 8console.log(time); // 30
Some callback functions can be provided.
1const { time, start, pause, reset, status } = useTimer({ 2 endTime, 3 onTimeOver: () => { 4 console.log('Time is over'); 5 }, 6});
1const { time, start, pause, reset, status } = useTimer({ 2 endTime, 3 onTimeUpdate: (time) => { 4 console.log('Time is updated', time); 5 }, 6});
The configuration and all its parameters are optional.
Property | Type | Default value | Description |
---|---|---|---|
autostart | boolean | false | Pass true to start timer automatically |
endTime | number | null | The value for which timer stops |
initialTime | number | 0 | The starting value for the timer |
interval | number | 1000 | The interval in milliseconds |
onTimeOver | function | Callback function that is called when time is over | |
onTimeUpdate | function | Callback function that is called when time is updated | |
step | number | 1 | The value to add to each increment / decrement |
timerType | string | "INCREMENTAL" | The choice between a value that increases ("INCREMENTAL") or decreases ("DECREMENTAL") |
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 2/5 approved changesets -- score normalized to 4
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
56 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More