minor fixes

This commit is contained in:
Ilya Kantor 2021-11-03 16:16:33 +03:00
parent 15f7acfc2a
commit 4541b7af75
4 changed files with 11 additions and 23 deletions

View file

@ -45,7 +45,7 @@
function clockStart() {
// set a new interval only if the clock is stopped
// otherwise we would rewrite the timerID reference to the running interval and wouldn't be able to stop the clock ever again
if (!timerId) {
if (!timerId) {
timerId = setInterval(update, 1000);
}
update(); // <-- start right now, don't wait 1 second till the first setInterval works
@ -56,7 +56,6 @@
timerId = null; // <-- clear timerID to indicate that the clock has been stopped, so that it is possible to start it again in clockStart()
}
clockStart();
</script>
<!-- click on this button calls clockStart() -->