1

Topic: JS to disconnect the timer

On page it is necessary at  conditions it is necessary  and o the timer
I launch

stpTimer = setInterval (stopTimer, 1000);

I disconnect

clearInterval (stpTimer);

but before each switch-off I do

console.log (stpTimer)

- I receive the increasing both sick number! And the timer like as !
That m by it to do! As  to disconnect the timer!?

2

Re: JS to disconnect the timer

setTimeout (function () {
clearInterval (timerId);
alert (' stop ');
}, 5000);

It is strange, why it is impossible simply

clearInterval (timerId);

All right I will try

3

Re: JS to disconnect the timer

;
Waits 5  and cancels  timerId and then still  .
I too clearInterval do.
But if to send on errands a page some time that stopTimer () starts to happen more often (I there console.log () delivered. On it )

4

Re: JS to disconnect the timer

Areostar;
Crookedly the code wrote, here and all problem:-Q

5

Re: JS to disconnect the timer

Here by the way found a class material on timers in JS http://webdiz.com.ua/glava2-osnovy-java … avascript/