react-use-count-down icon indicating copy to clipboard operation
react-use-count-down copied to clipboard

On expire functionality

Open mikhailgagarin opened this issue 5 years ago • 3 comments

Hi) Thank you for a nice and clean lib. I have a question/proposal for you. How is it supposed to be used to run some logic at the end of the timer? For example I need to trigger log out when timeLeft === 0, but it's a default value. Maybe it's better if timeLeft would be not equal zero by default on start/restart but to equal initialTime? Or maybe you're working on some kind of onExpire callback?

mikhailgagarin avatar Oct 29 '20 08:10 mikhailgagarin

Hey @mikhailgagarin onExpire callback is not something that should be added in my opinion. But I'm thinking about adding some extra fields that would show a current state of a counter like started, expired and running. I think it would solve your issue, right?

alexkhismatulin avatar Nov 04 '20 08:11 alexkhismatulin

Yeah, it would be great!

mikhailgagarin avatar Nov 04 '20 08:11 mikhailgagarin

It would be really cool if it was possible to pass a custom function for changes of state.

RodolfoSilva avatar Mar 13 '21 22:03 RodolfoSilva