mirror of
https://github.com/espruino/Espruino.git
synced 2025-12-08 19:06:15 +00:00
15 lines
277 B
JavaScript
15 lines
277 B
JavaScript
// timer again
|
|
|
|
var foo = setTimeout("result=1",50);
|
|
|
|
function clearAlreadyTriggeredTimeout() {
|
|
try {
|
|
clearTimeout(foo);
|
|
} catch(e) {
|
|
// should not throw when the `foo` timeout was already executed
|
|
result=0
|
|
}
|
|
}
|
|
|
|
setTimeout(clearAlreadyTriggeredTimeout, 100);
|