diff --git a/index.html b/index.html
index fbbf32d..4bc53e3 100644
--- a/index.html
+++ b/index.html
@@ -283,16 +283,18 @@
How does this work?
let stopped = true;
let ss = document.getElementById('stopstart');
+let st;
ss.onclick = function() {
if (stopped) {
console.log('starting');
stopped = false;
ss.children[0].innerText = 'stop';
document.dispatchEvent(new Event('nextping'));
- setTimeout(ss.onclick, 30000); // stop after 30s.
+ st = setTimeout(ss.onclick, 30000); // stop after 30s.
} else {
console.log('stopping');
stopped = true;
+ clearTimeout(st); // cancel the stop timeout, as it is stopped.
ss.children[0].innerText = 'play_arrow';
}
};