simon-git: puzzles (main): Ben Harris

Commits to Tartarus hosted VCS tartarus-commits at lists.tartarus.org
Wed Nov 9 22:30:28 GMT 2022


TL;DR:
  7982002 js: Switch to window.requestAnimationFrame() for timing

Repository:     https://git.tartarus.org/simon/puzzles.git
On the web:     https://git.tartarus.org/?p=simon/puzzles.git
Branch updated: main
Committer:      Ben Harris <bjh21 at bjh21.me.uk>
Date:           2022-11-09 22:30:28

commit 7982002a644328164bf0f77bf489876ad012e90d
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=7982002a644328164bf0f77bf489876ad012e90d;hp=c5a2446fae603a480de58b912fa349549bd9f247
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Wed Oct 26 10:05:04 2022 +0100

    js: Switch to window.requestAnimationFrame() for timing
    
    This is an API specifically designed for the purposes of timing
    animations.  Unlike setInterval, it tries to synchronise with the screen
    refresh rate.  It naturally passes us timing information, saving the
    need to construct a Date object every frame.  It has the nice feature
    that browsers (at least Firefox 91) will call it less frequently when
    the puzzle page isn't visible, which saves CPU time in puzzles that run
    a timer continuously.

 emcclib.js | 34 +++++++++++++++++++++-------------
 emccpre.js |  4 ++--
 2 files changed, 23 insertions(+), 15 deletions(-)



More information about the tartarus-commits mailing list