#hi, I have a problem with my timer

13 messages · Page 1 of 1 (latest)

willow rune
#

I'm a baby programmer, be free to tell me my mistakes and don't hesitate, I really need them

willow rune
#

I forgot to say:
Active is used to say if the timer is paused or not
sessionL and breakL is the length of each timer
session is used to say if the session timer is being used
timer is set to breakL and sessionL based on second but it is formatted later on the code

#

(there is a posibility that the code is fine, and mabye the environment is the problem)

tardy harness
#

This snippet is incomplete, so I don't know what you are doing with the value of "type", but the part that you showed doesn't make use of its value at all. If it actually gets used somewhere, you will need to fix the logic of how it is being set. The only place where it is set is inside an if statement that checkss if prev is equal to 0. That means the type can only change when timer is 0, and I don't see any code that stops it from becoming a negative number.

#

Also, it is common to update once per second instead of 10 times per second. I am not sure if you realize that setInterval uses milliseconds instead of centiseconds, or if you really want the higher frequency.

willow rune
tardy harness
willow rune
#

every time in the loop there is a setTimer with a prev and if timer reaches 0 it switches the timer and if not it will return the prev -1 meaning 1 second has passed

tardy harness
willow rune
#

and sorry

#

miss typed

#

really sorry