amrlabib / react-timer-hook

React timer hook
https://www.npmjs.com/package/react-timer-hook
MIT License
515 stars 112 forks source link

isPaused Flag #15

Closed obrunsmann closed 4 years ago

obrunsmann commented 4 years ago

I suggest an isPaused flag like. Currently I need to hold a state besides the timer hook to realize play/pause button.

mattgi commented 4 years ago

This feels like something that is really needed? Is there a way currently to determine if a stop watch is running?

isPaused or isRunning would be very welcomed additions.

obrunsmann commented 4 years ago

I added an addtional state hook but this is very dirty and I would appreciate having a flag just out of the timer hook.

jordanliu commented 4 years ago

I added an addtional state hook but this is very dirty and I would appreciate having a flag just out of the timer hook.

isPaused?

amrlabib commented 4 years ago

Thank you guys for the issue and sorry for my late response

We have now isRunning flag added to both useTimer and useStopwatch hooks, available from v2.0.2