Yes, I'm afraid I just copied and pasted - I didn't set up a button to check.
Unknown Timeout usually occurs when you call clearTimeout on a timer that's already fired or been deleted.
Unknown Timeout
clearTimeout
I think your problem is:
if(timeout) clearTimeout(timeout);
It should be:
if(timeout) { clearTimeout(timeout); timeout = undefined; }
because if it gets called twice the way it was before, it'll delete the timer that has previously been deleted.
@Gordon started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Yes, I'm afraid I just copied and pasted - I didn't set up a button to check.
Unknown Timeout
usually occurs when you callclearTimeout
on a timer that's already fired or been deleted.I think your problem is:
It should be:
because if it gets called twice the way it was before, it'll delete the timer that has previously been deleted.