mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 11:10:54 +00:00
add console logs for debugging extra frame
This commit is contained in:
parent
a744756037
commit
c3adf103a4
@ -2533,10 +2533,13 @@ jsPsych.pluginAPI = (function() {
|
||||
window.webkitRequestAnimationFrame || window.msRequestAnimationFrame;
|
||||
|
||||
var cancelAnimationFrame = window.cancelAnimationFrame || window.mozCancelAnimationFrame;
|
||||
var raf_count;
|
||||
|
||||
module.setTimeout = function(callback, delay){
|
||||
// record the start time
|
||||
raf_count = 0;
|
||||
var start_time = performance.now();
|
||||
console.log('setTimeout start time: ', start_time);
|
||||
var handle = requestAnimationFrame(function(timestamp) {
|
||||
// check for timeouts and update handle value
|
||||
checkForTimeouts(timestamp, start_time, callback, delay, handle);
|
||||
@ -2554,6 +2557,8 @@ jsPsych.pluginAPI = (function() {
|
||||
|
||||
function checkForTimeouts(timestamp, start_time, callback, delay, handle) {
|
||||
var curr_duration = performance.now() - start_time;
|
||||
raf_count++;
|
||||
console.log('count: ', raf_count, ' time: ', performance.now() - start_time);
|
||||
// check if the current duration is at least as long as the intended duration
|
||||
// minus half the typical frame duration (~16 ms). this helps avoid displaying the stimulus
|
||||
// for one too many frames.
|
||||
|
@ -69,6 +69,7 @@ jsPsych.plugins["html-keyboard-response"] = (function() {
|
||||
|
||||
// draw
|
||||
display_element.innerHTML = new_html;
|
||||
console.log('display time: ', performance.now());
|
||||
|
||||
// store response
|
||||
var response = {
|
||||
@ -99,6 +100,7 @@ jsPsych.plugins["html-keyboard-response"] = (function() {
|
||||
|
||||
// clear the display
|
||||
display_element.innerHTML = '';
|
||||
console.log('clear display time: ', performance.now());
|
||||
|
||||
// move on to the next trial
|
||||
jsPsych.finishTrial(trial_data);
|
||||
|
Loading…
Reference in New Issue
Block a user