shithub: puzzles

Download patch

ref: f7957d3aa080dcdfc4c6450ff2590c101b71d94b
parent: 7982002a644328164bf0f77bf489876ad012e90d
author: Ben Harris <bjh21@bjh21.me.uk>
date: Wed Nov 9 18:44:26 EST 2022

js: Reinstate a missing variable declaration

... and then decide there was no excuse for renaming the variable, so
now it has the same name it had before I started using
Window.requestAnimationFrame().

--- a/emcclib.js
+++ b/emcclib.js
@@ -200,16 +200,16 @@
         if (!timer_active) {
             timer_reference = performance.now();
             var frame = function(now) {
-                current_timer = null;
+                timer = null;
                 timer_callback((now - timer_reference) / 1000.0);
                 /* The callback may have deactivated the timer. */
                 if (timer_active) {
                     timer_reference = now;
-                    current_timer = window.requestAnimationFrame(frame);
+                    timer = window.requestAnimationFrame(frame);
                 }
             }
             timer_active = true;
-            current_timer = window.requestAnimationFrame(frame);
+            timer = window.requestAnimationFrame(frame);
         }
     },
 
@@ -221,9 +221,9 @@
     js_deactivate_timer: function() {
         if (timer_active) {
             timer_active = false;
-            if (current_timer !== null) {
-                window.cancelAnimationFrame(current_timer);
-                current_timer = null;
+            if (timer !== null) {
+                window.cancelAnimationFrame(timer);
+                timer = null;
             }
         }
     },
--- a/emccpre.js
+++ b/emccpre.js
@@ -90,6 +90,7 @@
 var midpoint_cache = [];
 
 // Variables used by js_activate_timer() and js_deactivate_timer().
+var timer = null;
 var timer_active = false;
 var timer_reference;