Skip to content

adiezdev/use-timer-count

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

useTimerCount

Readme in ES🇪🇸

👋 Hello

I have created these little hooks, inspired by some that are very similar

Please upgrade to 0.5.33

npm i use-timer-count

In this case I have built two hooks:

useCountDown

Very simple, it is a countdown counter, in which it is passed in minutes from where it starts and it also has a callback, so that it performs an action at the end.

const { days, hours, minutes, seconds, start, pause, restart } = 
useCountDown({ expiryTime: 0.5, onExpire: alert("Hi")) });

It returns the necessary data depending on the number of minutes elapsed, including controllers.

Resume

We send

Variables Description
expiryTime Time where the counter starts
onExpire Callback to perform an action at the end
autoStart Default true

We receive

Varables Description
day minutes a days
hours minutes a hours
minutes minutes a minutes
seconds minutes to seconds
start void
pause void
restart autostart true, resets the counter at startup

useStopwatch

This hook does the opposite effect, it is an incremental counter that listens until the time you pass it, that will be your top

const { days, hours, minutes, seconds, start, pause, reset} = 
useStopwatch({ offsetTime: 0.5 });

At the moment this one does not have a callback, so that it makes some action when finishing. Like the previous one, it gives you back everything you need

Resume

We send

Variables Description
offsetTime Time where the counter ends
autoStart default true

We recive

Varables Description
day minutes a days
hours minutes a hours
minutes minutes a minutes
seconds minutes to seconds
start void
pause void
reset autostart true, resets the counter at startup

Releases

No releases published

Packages

No packages published