Skip to content

Commit

Permalink
remove remaining timeout and display clears
Browse files Browse the repository at this point in the history
  • Loading branch information
jadeddelta committed Oct 16, 2024
1 parent 75e8ecc commit a13c8fd
Show file tree
Hide file tree
Showing 19 changed files with 4 additions and 57 deletions.
6 changes: 0 additions & 6 deletions packages/plugin-copying-task/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -926,9 +926,6 @@ var jsPsychCopyingTask = (function (jspsych) {
var endTime = Math.round(performance.now());
var response_time = endTime - startTime;

// kill any remaining setTimeout handlers
this.jsPsych.pluginAPI.clearAllTimeouts();

// clearInterval(interval_ID)

var trial_completed = checkIfDone();
Expand All @@ -946,9 +943,6 @@ var jsPsychCopyingTask = (function (jspsych) {
canvas_offset_top_left: [canvas_rect.top, canvas_rect.left],
};

// clear the display
display_element.innerHTML = "";

// move on to the next trial
this.jsPsych.finishTrial(trial_data);
};
Expand Down
1 change: 0 additions & 1 deletion packages/plugin-corsi-blocks/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,6 @@ class CorsiBlocksPlugin implements JsPsychPlugin<Info> {
};

const end_trial = () => {
display_element.innerHTML = "";
this.jsPsych.finishTrial(trial_data);
};

Expand Down
1 change: 0 additions & 1 deletion packages/plugin-gamepad/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ class GamepadPlugin implements JsPsychPlugin<Info> {

let finish_trial: Function = (data: object) => {
window.cancelAnimationFrame(this.animation_frame_id);
display_element.innerHTML = "";
this.minature_gamepad_wrapper.remove();
this.jsPsych.finishTrial(data);
};
Expand Down
7 changes: 0 additions & 7 deletions packages/plugin-html-choice/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,6 @@ class HtmlChoicePlugin implements JsPsychPlugin<Info> {

// function to end trial when it is time
const end_trial = () => {
// kill any remaining setTimeout handlers
this.jsPsych.pluginAPI.clearAllTimeouts();

// gather the data to store for the trial
var trial_data = {
rt: response.rt,
Expand All @@ -136,9 +133,6 @@ class HtmlChoicePlugin implements JsPsychPlugin<Info> {
value: response.value,
};

// clear the display
display_element.innerHTML = "";

// move on to the next trial
this.jsPsych.finishTrial(trial_data);
};
Expand All @@ -165,7 +159,6 @@ class HtmlChoicePlugin implements JsPsychPlugin<Info> {
}

if (trial.response_ends_trial) {
this.jsPsych.pluginAPI.clearAllTimeouts();
this.jsPsych.pluginAPI.setTimeout(end_trial, trial.time_after_response);
}
};
Expand Down
3 changes: 0 additions & 3 deletions packages/plugin-html-keyboard-response-raf/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,6 @@ class HtmlKeyboardResponseRafPlugin implements JsPsychPlugin<Info> {
response: response.key,
};

// clear the display
display_element.innerHTML = "";

// move on to the next trial
this.jsPsych.finishTrial(trial_data);
};
Expand Down
1 change: 0 additions & 1 deletion packages/plugin-html-keyboard-slider/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,6 @@ class HtmlKeyboardSliderPlugin implements JsPsychPlugin<Info> {
//clear and cancel things
clearKeybuffer();
this.jsPsych.pluginAPI.cancelKeyboardResponse(this.keyboardListener);
display_element.innerHTML = "";

// if no response and trial_duration not set
if (data.response === null && trial.trial_duration === null)
Expand Down
3 changes: 0 additions & 3 deletions packages/plugin-html-multi-response/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,6 @@ class HtmlMultiResponsePlugin implements JsPsychPlugin<Info> {

// function to end trial when it is time
const end_trial = () => {
// kill any remaining setTimeout handlers
this.jsPsych.pluginAPI.clearAllTimeouts();

// kill keyboard listeners
if (typeof keyboardListener !== "undefined") {
this.jsPsych.pluginAPI.cancelKeyboardResponse(keyboardListener);
Expand Down
3 changes: 0 additions & 3 deletions packages/plugin-html-swipe-response/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -414,9 +414,6 @@ class HtmlSwipeResponsePlugin implements JsPsychPlugin<Info> {

// function to end trial when it is time
const end_trial = () => {
// kill any remaining setTimeout handlers
this.jsPsych.pluginAPI.clearAllTimeouts();

// kill keyboard listeners
if (typeof keyboardListener !== "undefined") {
this.jsPsych.pluginAPI.cancelKeyboardResponse(keyboardListener);
Expand Down
4 changes: 0 additions & 4 deletions packages/plugin-html-vas-response/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,6 @@ var jsPsychHtmlVasResponse = (function (jspsych) {
};

function end_trial() {
jsPsych.pluginAPI.clearAllTimeouts();

// save data
var trialdata = {
rt: response.rt,
Expand All @@ -291,8 +289,6 @@ var jsPsychHtmlVasResponse = (function (jspsych) {
clicks: clicks,
};

display_element.innerHTML = "";

// next trial
jsPsych.finishTrial(trialdata);
}
Expand Down
6 changes: 0 additions & 6 deletions packages/plugin-image-array-keyboard-response/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,6 @@ class ImageArrayKeyboardResponsePlugin implements JsPsychPlugin<Info> {

// function to end trial when it is time
const end_trial = () => {
// kill any remaining setTimeout handlers
this.jsPsych.pluginAPI.clearAllTimeouts();

// kill keyboard listeners
if (typeof keyboardListener !== "undefined") {
this.jsPsych.pluginAPI.cancelKeyboardResponse(keyboardListener);
Expand All @@ -231,9 +228,6 @@ class ImageArrayKeyboardResponsePlugin implements JsPsychPlugin<Info> {
response: response.key,
};

// clear the display
display_element.innerHTML = "";

// move on to the next trial
this.jsPsych.finishTrial(trial_data);
};
Expand Down
3 changes: 0 additions & 3 deletions packages/plugin-image-multi-response/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -346,9 +346,6 @@ class ImageMultiResponsePlugin implements JsPsychPlugin<Info> {

// function to end trial when it is time
const end_trial = () => {
// kill any remaining setTimeout handlers
this.jsPsych.pluginAPI.clearAllTimeouts();

// kill keyboard listeners
if (typeof keyboardListener !== "undefined") {
this.jsPsych.pluginAPI.cancelKeyboardResponse(keyboardListener);
Expand Down
6 changes: 0 additions & 6 deletions packages/plugin-image-swipe-response/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -394,9 +394,6 @@ class ImageSwipeResponsePlugin implements JsPsychPlugin<Info> {

// function to end trial when it is time
const end_trial = () => {
// kill any remaining setTimeout handlers
this.jsPsych.pluginAPI.clearAllTimeouts();

// kill keyboard listeners
if (typeof keyboardListener !== "undefined") {
this.jsPsych.pluginAPI.cancelKeyboardResponse(keyboardListener);
Expand All @@ -413,9 +410,6 @@ class ImageSwipeResponsePlugin implements JsPsychPlugin<Info> {
response_source: response.source,
};

// clear the display
display_element.innerHTML = "";

// move on to the next trial
this.jsPsych.finishTrial(trial_data);
};
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-ios/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ var jsPsychIos = (function (jspsych) {
prompt: trial.prompt,
response: response.response,
};
display_element.innerHTML = "";

// next trial
jsPsych.finishTrial(trialdata);
}
Expand Down
3 changes: 1 addition & 2 deletions packages/plugin-libet-intentional-binding/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -569,8 +569,7 @@ var jsPsychLibetIntentionalBinding = (function (jspsych) {
callback_function: function (info) {
// trial_data.rt = info.rt;
// trial_data.keypress_ms = performance.now();
// cancel end of trial timeout
jsPsych.pluginAPI.clearAllTimeouts();

// compute clock theta at the time of response
trial_data.theta.keypress = clock.theta;
if (info.rt < trial.early_ms) {
Expand Down
3 changes: 0 additions & 3 deletions packages/plugin-rok/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1065,9 +1065,6 @@ class RokPlugin implements JsPsychPlugin<Info> {
aperture_mode: aperture_mode,
};

//Clear the body
display_element.innerHTML = "";

//Restore the settings to JsPsych defaults
body.style.margin = originalMargin;
body.style.padding = originalPadding;
Expand Down
3 changes: 1 addition & 2 deletions packages/plugin-self-paced-reading/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,7 @@ class SelfPacedReadingPlugin implements JsPsychPlugin<Info> {
ctx.fillRect(canvas_rect[0], canvas_rect[1], canvas_rect[2], canvas_rect[3]);
}

// kill any remaining setTimeout handlers + kill keyboard listeners
this.jsPsych.pluginAPI.clearAllTimeouts();
// kill any remaining keyboard listeners
this.jsPsych.pluginAPI.cancelKeyboardResponse(keyboardListener);

// move on to the next trial
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-survey-number/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ class SurveyNumberPlugin implements JsPsychPlugin<Info> {
rt: response_time,
response: question_data,
};
display_element.innerHTML = "";

// next trial
this.jsPsych.finishTrial(trialdata);
});
Expand Down
2 changes: 0 additions & 2 deletions packages/plugin-survey-slider/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,6 @@ class SurveySliderPlugin implements JsPsychPlugin<Info> {
question_order: JSON.stringify(question_order),
};

display_element.innerHTML = "";

// next trial
this.jsPsych.finishTrial(trial_data);
});
Expand Down
2 changes: 0 additions & 2 deletions packages/plugin-vsl-grid-scene/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ class VslGridScenePlugin implements JsPsychPlugin<Info> {
}, trial.trial_duration);

const endTrial = () => {
display_element.innerHTML = "";

var trial_data = {
stimulus: trial.stimuli,
};
Expand Down

0 comments on commit a13c8fd

Please sign in to comment.