0.5.33 β€’ Published 2 years ago

use-timer-count v0.5.33

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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

VariablesDescription
expiryTimeTime where the counter starts
onExpireCallback to perform an action at the end
autoStartDefault true

We receive

VarablesDescription
dayminutes a days
hoursminutes a hours
minutesminutes a minutes
secondsminutes to seconds
startvoid
pausevoid
restartautostart 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

VariablesDescription
offsetTimeTime where the counter ends
autoStartdefault true

We recive

VarablesDescription
dayminutes a days
hoursminutes a hours
minutesminutes a minutes
secondsminutes to seconds
startvoid
pausevoid
resetautostart true, resets the counter at startup
0.5.33

2 years ago

0.5.32

2 years ago

0.5.31

2 years ago

0.5.3

2 years ago

0.5.2

2 years ago

0.5.1

2 years ago

0.5.0

2 years ago