clearTimeout not working properly #202
Replies: 3 comments
-
Posted at 2014-02-13 by @gfwilliams Hi, What do you mean by That means that if you're doing Simply doing that in your code fixes it:
Personally I'd just check for undefined with |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-02-13 by randunel Later edit: I see what you mean, thanks for the clarification. I expected the setInterval integer values to be reused like the setWatch values are, and when I saw them rising to infinity I assumed something was wrong :) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-02-13 by @gfwilliams Espruino just makes the intervals one more than the last one in the list (it's faster/easier than searching for a free one). If you remove all intervals at some point then the numbers will drop back to 1. It might be worth worrying about if it wasn't for the 64 bit numbers used as indexes - that should keep you going some time :) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-02-12 by randunel
I created a LED dimming function (source code). It does what I expect it to do every
DURATION
miliseconds, with an exception. I added two console logs to highlight the problem, this is the line which does not work,clearInterval(stepInterval)
, loggingERROR: Unknown Interval
.All the other
clearInterval
s seem to be working. Here is some sample output from the script:So the intervals keep adding up, I assume it will either run out of memory or gray dragons will come out of the espruino board.
Any hints?
Beta Was this translation helpful? Give feedback.
All reactions