i have a timer set up. I have a pause button that I want to
have on release will pause the timer at its current position and
continue from where it left off . How would I script it to do this?
I am doing this with my audio and figured it must be similar for
the timer but I can't get it to work properly. If anyone could
please shed some light I would greatly appreciate it.
A timer does not have a pause. A timer calls another function
at intervals. You can stop the timer and restart (stop and restart
calling another function). You use clearInterval to stop the timer
and setInterval to start it.
If you need to keep track of the time the timer was running
you need a variable to accumulate the start and stop time each time
the timer is stopped and started.