mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 08:01:30 -07:00
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().
This commit is contained in:
12
emcclib.js
12
emcclib.js
@ -200,16 +200,16 @@ mergeInto(LibraryManager.library, {
|
||||
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 @@ mergeInto(LibraryManager.library, {
|
||||
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;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -90,6 +90,7 @@ var midpoint_test_str = "ABCDEFGHIKLMNOPRSTUVWXYZ0123456789";
|
||||
var midpoint_cache = [];
|
||||
|
||||
// Variables used by js_activate_timer() and js_deactivate_timer().
|
||||
var timer = null;
|
||||
var timer_active = false;
|
||||
var timer_reference;
|
||||
|
||||
|
Reference in New Issue
Block a user