shithub: puzzles

Download patch

ref: a62217e9b42e81a66369f91600991944d148e0a9
parent: 0254a163ff002aca56a6e08d7a5799f34cf48d94
author: Ben Harris <bjh21@bjh21.me.uk>
date: Sun Oct 23 07:15:31 EDT 2022

js: Use less-modern syntax in update_pixel_ratio

Stealing code from the MDN has the consequence that it uses shiny ES6
features like "const", "let", and "=>".  This looks a bit odd among
the more conservative style of the rest of Puzzles, so I've
downgraded it to "var" and "function".  I'll let the template string
stay because that actually helps readability.

--- a/emccpre.js
+++ b/emccpre.js
@@ -533,8 +533,8 @@
      * <https://developer.mozilla.org/en-US/docs/Web/API/Window/
      * devicePixelRatio> (CC0).
      */
-    const update_pixel_ratio = () => {
-        let dpr = window.devicePixelRatio;
+    var update_pixel_ratio = function() {
+        var dpr = window.devicePixelRatio;
         resizable_div.style.width = onscreen_canvas.width / dpr + "px";
         matchMedia(`(resolution: ${dpr}dppx)`)
             .addEventListener("change", update_pixel_ratio, { once: true })