]> git.sesse.net Git - remoteglot/commitdiff
Evidently clearTimeout() is expensive (~3 ms used on load), so do not call it unless...
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 24 Dec 2022 23:02:42 +0000 (00:02 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 24 Dec 2022 23:02:42 +0000 (00:02 +0100)
www/js/remoteglot.js

index f4581cf72644032c0b4a6515e1320c7926648222..7b030cab1cf491d9aa786fdad89aec19164ae702 100644 (file)
@@ -1226,6 +1226,9 @@ let update_board = function() {
                return;
        }
 
+       if (clock_timer !== null) {
+               clearTimeout(clock_timer);
+       }
        update_clock();
 
        // The score.
@@ -1497,7 +1500,7 @@ let update_num_viewers = function(num_viewers) {
 }
 
 let update_clock = function() {
-       clearTimeout(clock_timer);
+       clock_timer = null;
 
        let data = displayed_analysis_data || current_analysis_data;
        if (!data) return;