Clean my (Pomodoro) Clock!

Clean my (Pomodoro) Clock!
0

#1

I’m putting the final touches on my pomodoro clock, and I’d like feedback from you all. I’m already aware of a couple of issues that I’d like help resolving, but I really need more critical eyes on the project.

The link: https://ekazubuike.github.io/pomodoro_timer/

Current issues: First, when you click the start button multiple times, the clock speeds up. I’m currently at a loss when it comes to fixing that. Next, once the clock has sped up, it cannot be paused. Lastly, any feedback on refactoring my code would be appreciated. I tried separating things out into different functions, but I’m not sure if I went about it in a way that’s clear to others.

Let me know what you think!


#2

You can resolve your issue by modifying your startTimer and pauseTimer functions as follows:

function startTimer() {
    startBtn.disabled = true;
    x = setInterval(function(){toTime(time)}, 1000);
}

function pauseTimer() {
    startBtn.disabled = false;
    clearInterval(x);
}

This will prevent the Start button from being clicked again until the Pause button is clicked.

You also have a bug in the - button of the right text box (for setting break time) in that it allows negative numbers for time.

One other recommendation is to put labels above the timer setting boxes to clearly indicate which time (work or break) you are setting. Currently, you have to guess or look at the code to know for sure.


#3

Thanks for the feedback! That’s helpful.