mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 19:20:55 +00:00
update rAF handle in timeout_handlers so that it is cleared with clearAllTimeouts
This commit is contained in:
parent
2214115e44
commit
16e51aa2fc
@ -2560,10 +2560,12 @@ jsPsych.pluginAPI = (function() {
|
||||
if (curr_duration >= delay - 8) {
|
||||
callback(curr_duration);
|
||||
} else {
|
||||
// setup the next rAF call and update handle value
|
||||
// remove the old rAF handle from timeout_handlers, setup the next rAF call, and update handle and timeout_handlers
|
||||
timeout_handlers = timeout_handlers.filter(function(el) { return el !== handle; });
|
||||
handle = requestAnimationFrame(function(timestamp) {
|
||||
checkForTimeouts(timestamp, start_time, callback, delay, handle);
|
||||
});
|
||||
timeout_handlers.push(handle);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user