useTimer
See original GitHub issueClear and concise description of the problem
It would be helpful to have a timer composable that would execute a callback after it’s finished, something like useTimer from React, and if it sounds cool I could work on a PR asap.
Suggested solution
Usage would be like:
const { timer, start } = useTimer(5, () => {
isButtonDisabled.value = false;
});
I’ve created a stackblitz initial implementation with some controls, but the API could be simpler.
Alternative
No response
Additional context
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn’t already an issue that request the same feature to avoid creating a duplicate.
Issue Analytics
- State:
- Created a year ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
use-timer - npm
A timer hook for React. Latest version: 2.0.1, last published: 2 years ago. Start using use-timer in your project by running `npm i ......
Read more >thibaultboursier/use-timer: A timer hook for React - GitHub
Simple timer turned into React Hooks. Read about Hooks feature. Installation. npm i use-timer.
Read more >useTimer - react-timer-hook - CodeSandbox
CodeSandbox is an online editor tailored for web applications.
Read more >Develop a Custom useTimer Hook in React
A small example to create a custom useTimer Hook for React Applications to responsibly get around the mischievous setInterval function.
Read more >Invalid hook call when calling useTimer() inside useEffect ...
Hooks must not be called into javascript function which are not a function component or a custom hook. Note that hooks only works...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@chaii3 for sure, I will draft something as soon as I can
So with coundown and countup option ?