I am now on the Pomodoro Timer challenge on Free Code Camp and, let me tell you, it’s much more challenging than I anticipated.
After a few hours of plugging away at my keyboard, I now have a nice interface set up, my buttons to set the session and break lengths work, and, if you click the start button at the bottom, the number in the middle of the circle will count down to 0.
Left to do:
- The counter in the circle currently counts down by seconds, but the number that is there is supposed to represent minutes. I need to display a looping counter of 60 seconds and decrease the minutes every time it loops.
- When I click the Pause button, the timer should stop. Right now, it does virtually nothing. It’s a useless button. I thought that using clearInterval() would stop it, but evidently not.I managed to figure this one out while writing the post. The setInterval returns an ID which has to be used with clearInterval in order to stop it.
- Create a working reset button. When a user clicks reset, the number in the circle should reset to the given session length. Right now, this button is useless.
I had the thought to use a true or false value to check if the timer was running or not.If the timer isn’t running, then the user can reset it.
- Implement the break session. I have to set it up so that when the countdown for the session reaches 0, it will start counting down on break time. I’m currently assuming that functions could be the same, with slightly varying values.