Checking whether clearInterval has been called?

Viewed 32580

Given this code:

bob = setInterval(function, 1000);
clearInterval(bob);

Is there now a way to know if that interval has been cleared?

Currently, I keep track of this myself, by unsetting 'bob', but I'm curious if my extra line of code is unnecessary:

clearInterval(bob);
bob = null;
if (!bob) itIsCleared();

Thanks!

3 Answers

So this is a very late answer but if you do something like this

this.myInterval = setInterval(....);
this.myInterval = clearInterval(this.myInterval);

It will force the variable myInterval to be undefined and thus you can check the clearing of the interval by doing if(!this.myInterval)

Related