mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 11:10:54 +00:00
remove now unnecessary timeout clears and display clears
This commit is contained in:
parent
313edc2af5
commit
d520b70fbf
@ -278,9 +278,6 @@ class AudioButtonResponsePlugin implements JsPsychPlugin<Info> {
|
|||||||
|
|
||||||
// function to end trial when it is time
|
// function to end trial when it is time
|
||||||
const end_trial = () => {
|
const end_trial = () => {
|
||||||
// kill any remaining setTimeout handlers
|
|
||||||
this.jsPsych.pluginAPI.clearAllTimeouts();
|
|
||||||
|
|
||||||
// stop the audio file if it is playing
|
// stop the audio file if it is playing
|
||||||
// remove end event listeners if they exist
|
// remove end event listeners if they exist
|
||||||
if (context !== null) {
|
if (context !== null) {
|
||||||
@ -299,9 +296,6 @@ class AudioButtonResponsePlugin implements JsPsychPlugin<Info> {
|
|||||||
response: response.button,
|
response: response.button,
|
||||||
};
|
};
|
||||||
|
|
||||||
// clear the display
|
|
||||||
display_element.innerHTML = "";
|
|
||||||
|
|
||||||
// move on to the next trial
|
// move on to the next trial
|
||||||
this.jsPsych.finishTrial(trial_data);
|
this.jsPsych.finishTrial(trial_data);
|
||||||
|
|
||||||
|
@ -182,9 +182,6 @@ class AudioKeyboardResponsePlugin implements JsPsychPlugin<Info> {
|
|||||||
|
|
||||||
// function to end trial when it is time
|
// function to end trial when it is time
|
||||||
const end_trial = () => {
|
const end_trial = () => {
|
||||||
// kill any remaining setTimeout handlers
|
|
||||||
this.jsPsych.pluginAPI.clearAllTimeouts();
|
|
||||||
|
|
||||||
// stop the audio file if it is playing
|
// stop the audio file if it is playing
|
||||||
// remove end event listeners if they exist
|
// remove end event listeners if they exist
|
||||||
if (context !== null) {
|
if (context !== null) {
|
||||||
@ -206,9 +203,6 @@ class AudioKeyboardResponsePlugin implements JsPsychPlugin<Info> {
|
|||||||
response: response.key,
|
response: response.key,
|
||||||
};
|
};
|
||||||
|
|
||||||
// clear the display
|
|
||||||
display_element.innerHTML = "";
|
|
||||||
|
|
||||||
// move on to the next trial
|
// move on to the next trial
|
||||||
this.jsPsych.finishTrial(trial_data);
|
this.jsPsych.finishTrial(trial_data);
|
||||||
|
|
||||||
|
@ -340,9 +340,6 @@ class AudioSliderResponsePlugin implements JsPsychPlugin<Info> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const end_trial = () => {
|
const end_trial = () => {
|
||||||
// kill any remaining setTimeout handlers
|
|
||||||
this.jsPsych.pluginAPI.clearAllTimeouts();
|
|
||||||
|
|
||||||
// stop the audio file if it is playing
|
// stop the audio file if it is playing
|
||||||
// remove end event listeners if they exist
|
// remove end event listeners if they exist
|
||||||
if (context !== null) {
|
if (context !== null) {
|
||||||
@ -362,8 +359,6 @@ class AudioSliderResponsePlugin implements JsPsychPlugin<Info> {
|
|||||||
response: response.response,
|
response: response.response,
|
||||||
};
|
};
|
||||||
|
|
||||||
display_element.innerHTML = "";
|
|
||||||
|
|
||||||
// next trial
|
// next trial
|
||||||
this.jsPsych.finishTrial(trialdata);
|
this.jsPsych.finishTrial(trialdata);
|
||||||
|
|
||||||
|
@ -447,8 +447,6 @@ class BrowserCheckPlugin implements JsPsychPlugin<Info> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private end_trial(feature_data) {
|
private end_trial(feature_data) {
|
||||||
this.jsPsych.getDisplayElement().innerHTML = "";
|
|
||||||
|
|
||||||
const trial_data = { ...Object.fromEntries(feature_data) };
|
const trial_data = { ...Object.fromEntries(feature_data) };
|
||||||
|
|
||||||
this.jsPsych.finishTrial(trial_data);
|
this.jsPsych.finishTrial(trial_data);
|
||||||
|
@ -200,18 +200,12 @@ class CanvasButtonResponsePlugin implements JsPsychPlugin<Info> {
|
|||||||
|
|
||||||
// function to end trial when it is time
|
// function to end trial when it is time
|
||||||
const end_trial = () => {
|
const end_trial = () => {
|
||||||
// kill any remaining setTimeout handlers
|
|
||||||
this.jsPsych.pluginAPI.clearAllTimeouts();
|
|
||||||
|
|
||||||
// gather the data to store for the trial
|
// gather the data to store for the trial
|
||||||
var trial_data = {
|
var trial_data = {
|
||||||
rt: response.rt,
|
rt: response.rt,
|
||||||
response: response.button,
|
response: response.button,
|
||||||
};
|
};
|
||||||
|
|
||||||
// clear the display
|
|
||||||
display_element.innerHTML = "";
|
|
||||||
|
|
||||||
// move on to the next trial
|
// move on to the next trial
|
||||||
this.jsPsych.finishTrial(trial_data);
|
this.jsPsych.finishTrial(trial_data);
|
||||||
};
|
};
|
||||||
|
@ -123,9 +123,6 @@ class CanvasKeyboardResponsePlugin implements JsPsychPlugin<Info> {
|
|||||||
|
|
||||||
// function to end trial when it is time
|
// function to end trial when it is time
|
||||||
const end_trial = () => {
|
const end_trial = () => {
|
||||||
// kill any remaining setTimeout handlers
|
|
||||||
this.jsPsych.pluginAPI.clearAllTimeouts();
|
|
||||||
|
|
||||||
// kill keyboard listeners
|
// kill keyboard listeners
|
||||||
if (typeof keyboardListener !== "undefined") {
|
if (typeof keyboardListener !== "undefined") {
|
||||||
this.jsPsych.pluginAPI.cancelKeyboardResponse(keyboardListener);
|
this.jsPsych.pluginAPI.cancelKeyboardResponse(keyboardListener);
|
||||||
@ -137,9 +134,6 @@ class CanvasKeyboardResponsePlugin implements JsPsychPlugin<Info> {
|
|||||||
response: response.key,
|
response: response.key,
|
||||||
};
|
};
|
||||||
|
|
||||||
// clear the display
|
|
||||||
display_element.innerHTML = "";
|
|
||||||
|
|
||||||
// move on to the next trial
|
// move on to the next trial
|
||||||
this.jsPsych.finishTrial(trial_data);
|
this.jsPsych.finishTrial(trial_data);
|
||||||
};
|
};
|
||||||
|
@ -174,8 +174,6 @@ class CanvasSliderResponsePlugin implements JsPsychPlugin<Info> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const end_trial = () => {
|
const end_trial = () => {
|
||||||
this.jsPsych.pluginAPI.clearAllTimeouts();
|
|
||||||
|
|
||||||
// save data
|
// save data
|
||||||
var trialdata = {
|
var trialdata = {
|
||||||
rt: response.rt,
|
rt: response.rt,
|
||||||
@ -183,8 +181,6 @@ class CanvasSliderResponsePlugin implements JsPsychPlugin<Info> {
|
|||||||
slider_start: trial.slider_start,
|
slider_start: trial.slider_start,
|
||||||
};
|
};
|
||||||
|
|
||||||
display_element.innerHTML = "";
|
|
||||||
|
|
||||||
// next trial
|
// next trial
|
||||||
this.jsPsych.finishTrial(trialdata);
|
this.jsPsych.finishTrial(trialdata);
|
||||||
};
|
};
|
||||||
|
@ -240,7 +240,6 @@ class CategorizeAnimationPlugin implements JsPsychPlugin<Info> {
|
|||||||
|
|
||||||
const endTrial = () => {
|
const endTrial = () => {
|
||||||
clearInterval(animate_interval); // stop animation!
|
clearInterval(animate_interval); // stop animation!
|
||||||
display_element.innerHTML = ""; // clear everything
|
|
||||||
this.jsPsych.finishTrial(trial_data);
|
this.jsPsych.finishTrial(trial_data);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -134,9 +134,6 @@ class CategorizeHtmlPlugin implements JsPsychPlugin<Info> {
|
|||||||
|
|
||||||
// create response function
|
// create response function
|
||||||
const after_response = (info: { key: string; rt: number }) => {
|
const after_response = (info: { key: string; rt: number }) => {
|
||||||
// kill any remaining setTimeout handlers
|
|
||||||
this.jsPsych.pluginAPI.clearAllTimeouts();
|
|
||||||
|
|
||||||
// clear keyboard listener
|
// clear keyboard listener
|
||||||
this.jsPsych.pluginAPI.cancelAllKeyboardResponses();
|
this.jsPsych.pluginAPI.cancelAllKeyboardResponses();
|
||||||
|
|
||||||
@ -153,8 +150,6 @@ class CategorizeHtmlPlugin implements JsPsychPlugin<Info> {
|
|||||||
response: info.key,
|
response: info.key,
|
||||||
};
|
};
|
||||||
|
|
||||||
display_element.innerHTML = "";
|
|
||||||
|
|
||||||
var timeout = info.rt == null;
|
var timeout = info.rt == null;
|
||||||
doFeedback(correct, timeout);
|
doFeedback(correct, timeout);
|
||||||
};
|
};
|
||||||
@ -177,7 +172,6 @@ class CategorizeHtmlPlugin implements JsPsychPlugin<Info> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const endTrial = () => {
|
const endTrial = () => {
|
||||||
display_element.innerHTML = "";
|
|
||||||
this.jsPsych.finishTrial(trial_data);
|
this.jsPsych.finishTrial(trial_data);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -135,9 +135,6 @@ class CategorizeImagePlugin implements JsPsychPlugin<Info> {
|
|||||||
|
|
||||||
// create response function
|
// create response function
|
||||||
const after_response = (info: { key: string; rt: number }) => {
|
const after_response = (info: { key: string; rt: number }) => {
|
||||||
// kill any remaining setTimeout handlers
|
|
||||||
this.jsPsych.pluginAPI.clearAllTimeouts();
|
|
||||||
|
|
||||||
// clear keyboard listener
|
// clear keyboard listener
|
||||||
this.jsPsych.pluginAPI.cancelAllKeyboardResponses();
|
this.jsPsych.pluginAPI.cancelAllKeyboardResponses();
|
||||||
|
|
||||||
@ -154,8 +151,6 @@ class CategorizeImagePlugin implements JsPsychPlugin<Info> {
|
|||||||
response: info.key,
|
response: info.key,
|
||||||
};
|
};
|
||||||
|
|
||||||
display_element.innerHTML = "";
|
|
||||||
|
|
||||||
var timeout = info.rt == null;
|
var timeout = info.rt == null;
|
||||||
doFeedback(correct, timeout);
|
doFeedback(correct, timeout);
|
||||||
};
|
};
|
||||||
@ -178,7 +173,6 @@ class CategorizeImagePlugin implements JsPsychPlugin<Info> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const endTrial = () => {
|
const endTrial = () => {
|
||||||
display_element.innerHTML = "";
|
|
||||||
this.jsPsych.finishTrial(trial_data);
|
this.jsPsych.finishTrial(trial_data);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -105,7 +105,6 @@ class ClozePlugin implements JsPsychPlugin<Info> {
|
|||||||
response: answers,
|
response: answers,
|
||||||
};
|
};
|
||||||
|
|
||||||
display_element.innerHTML = "";
|
|
||||||
this.jsPsych.finishTrial(trial_data);
|
this.jsPsych.finishTrial(trial_data);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -98,7 +98,6 @@ class ExternalHtmlPlugin implements JsPsychPlugin<Info> {
|
|||||||
rt: Math.round(performance.now() - t0),
|
rt: Math.round(performance.now() - t0),
|
||||||
url: trial.url,
|
url: trial.url,
|
||||||
};
|
};
|
||||||
display_element.innerHTML = "";
|
|
||||||
this.jsPsych.finishTrial(trial_data);
|
this.jsPsych.finishTrial(trial_data);
|
||||||
trial_complete();
|
trial_complete();
|
||||||
};
|
};
|
||||||
|
@ -474,8 +474,6 @@ class FreeSortPlugin implements JsPsychPlugin<Info> {
|
|||||||
rt: rt,
|
rt: rt,
|
||||||
};
|
};
|
||||||
|
|
||||||
// advance to next part
|
|
||||||
display_element.innerHTML = "";
|
|
||||||
this.jsPsych.finishTrial(trial_data);
|
this.jsPsych.finishTrial(trial_data);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -269,9 +269,6 @@ class HtmlAudioResponsePlugin implements JsPsychPlugin<Info> {
|
|||||||
this.recorder.removeEventListener("start", this.start_event_handler);
|
this.recorder.removeEventListener("start", this.start_event_handler);
|
||||||
this.recorder.removeEventListener("stop", this.stop_event_handler);
|
this.recorder.removeEventListener("stop", this.stop_event_handler);
|
||||||
|
|
||||||
// kill any remaining setTimeout handlers
|
|
||||||
this.jsPsych.pluginAPI.clearAllTimeouts();
|
|
||||||
|
|
||||||
// gather the data to store for the trial
|
// gather the data to store for the trial
|
||||||
var trial_data: any = {
|
var trial_data: any = {
|
||||||
rt: this.rt,
|
rt: this.rt,
|
||||||
@ -286,9 +283,6 @@ class HtmlAudioResponsePlugin implements JsPsychPlugin<Info> {
|
|||||||
URL.revokeObjectURL(this.audio_url);
|
URL.revokeObjectURL(this.audio_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear the display
|
|
||||||
display_element.innerHTML = "";
|
|
||||||
|
|
||||||
// move on to the next trial
|
// move on to the next trial
|
||||||
this.jsPsych.finishTrial(trial_data);
|
this.jsPsych.finishTrial(trial_data);
|
||||||
}
|
}
|
||||||
|
@ -159,9 +159,6 @@ class HtmlButtonResponsePlugin implements JsPsychPlugin<Info> {
|
|||||||
|
|
||||||
// function to end trial when it is time
|
// function to end trial when it is time
|
||||||
const end_trial = () => {
|
const end_trial = () => {
|
||||||
// kill any remaining setTimeout handlers
|
|
||||||
this.jsPsych.pluginAPI.clearAllTimeouts();
|
|
||||||
|
|
||||||
// gather the data to store for the trial
|
// gather the data to store for the trial
|
||||||
var trial_data = {
|
var trial_data = {
|
||||||
rt: response.rt,
|
rt: response.rt,
|
||||||
@ -169,9 +166,6 @@ class HtmlButtonResponsePlugin implements JsPsychPlugin<Info> {
|
|||||||
response: response.button,
|
response: response.button,
|
||||||
};
|
};
|
||||||
|
|
||||||
// clear the display
|
|
||||||
display_element.innerHTML = "";
|
|
||||||
|
|
||||||
// move on to the next trial
|
// move on to the next trial
|
||||||
this.jsPsych.finishTrial(trial_data);
|
this.jsPsych.finishTrial(trial_data);
|
||||||
};
|
};
|
||||||
|
@ -194,8 +194,6 @@ class HtmlSliderResponsePlugin implements JsPsychPlugin<Info> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const end_trial = () => {
|
const end_trial = () => {
|
||||||
this.jsPsych.pluginAPI.clearAllTimeouts();
|
|
||||||
|
|
||||||
// save data
|
// save data
|
||||||
var trialdata = {
|
var trialdata = {
|
||||||
rt: response.rt,
|
rt: response.rt,
|
||||||
@ -204,8 +202,6 @@ class HtmlSliderResponsePlugin implements JsPsychPlugin<Info> {
|
|||||||
response: response.response,
|
response: response.response,
|
||||||
};
|
};
|
||||||
|
|
||||||
display_element.innerHTML = "";
|
|
||||||
|
|
||||||
// next trial
|
// next trial
|
||||||
this.jsPsych.finishTrial(trialdata);
|
this.jsPsych.finishTrial(trialdata);
|
||||||
};
|
};
|
||||||
|
@ -270,9 +270,6 @@ class HtmlVideoResponsePlugin implements JsPsychPlugin<Info> {
|
|||||||
this.recorder.removeEventListener("start", this.start_event_handler);
|
this.recorder.removeEventListener("start", this.start_event_handler);
|
||||||
this.recorder.removeEventListener("stop", this.stop_event_handler);
|
this.recorder.removeEventListener("stop", this.stop_event_handler);
|
||||||
|
|
||||||
// clear any remaining setTimeout handlers
|
|
||||||
this.jsPsych.pluginAPI.clearAllTimeouts();
|
|
||||||
|
|
||||||
// gather the data to store for the trial
|
// gather the data to store for the trial
|
||||||
var trial_data: any = {
|
var trial_data: any = {
|
||||||
rt: this.rt,
|
rt: this.rt,
|
||||||
@ -286,9 +283,6 @@ class HtmlVideoResponsePlugin implements JsPsychPlugin<Info> {
|
|||||||
URL.revokeObjectURL(this.video_url);
|
URL.revokeObjectURL(this.video_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear the display
|
|
||||||
display_element.innerHTML = "";
|
|
||||||
|
|
||||||
// move on to the next trial
|
// move on to the next trial
|
||||||
this.jsPsych.finishTrial(trial_data);
|
this.jsPsych.finishTrial(trial_data);
|
||||||
}
|
}
|
||||||
|
@ -202,9 +202,6 @@ class IatHtmlPlugin implements JsPsychPlugin<Info> {
|
|||||||
|
|
||||||
// function to end trial when it is time
|
// function to end trial when it is time
|
||||||
const end_trial = () => {
|
const end_trial = () => {
|
||||||
// kill any remaining setTimeout handlers
|
|
||||||
this.jsPsych.pluginAPI.clearAllTimeouts();
|
|
||||||
|
|
||||||
// kill keyboard listeners
|
// kill keyboard listeners
|
||||||
if (typeof keyboardListener !== "undefined") {
|
if (typeof keyboardListener !== "undefined") {
|
||||||
this.jsPsych.pluginAPI.cancelKeyboardResponse(keyboardListener);
|
this.jsPsych.pluginAPI.cancelKeyboardResponse(keyboardListener);
|
||||||
@ -218,9 +215,6 @@ class IatHtmlPlugin implements JsPsychPlugin<Info> {
|
|||||||
correct: response.correct,
|
correct: response.correct,
|
||||||
};
|
};
|
||||||
|
|
||||||
// clears the display
|
|
||||||
display_element.innerHTML = "";
|
|
||||||
|
|
||||||
// move on to the next trial
|
// move on to the next trial
|
||||||
this.jsPsych.finishTrial(trial_data);
|
this.jsPsych.finishTrial(trial_data);
|
||||||
};
|
};
|
||||||
|
@ -202,9 +202,6 @@ class IatImagePlugin implements JsPsychPlugin<Info> {
|
|||||||
|
|
||||||
// function to end trial when it is time
|
// function to end trial when it is time
|
||||||
const end_trial = () => {
|
const end_trial = () => {
|
||||||
// kill any remaining setTimeout handlers
|
|
||||||
this.jsPsych.pluginAPI.clearAllTimeouts();
|
|
||||||
|
|
||||||
// kill keyboard listeners
|
// kill keyboard listeners
|
||||||
if (typeof keyboardListener !== "undefined") {
|
if (typeof keyboardListener !== "undefined") {
|
||||||
this.jsPsych.pluginAPI.cancelKeyboardResponse(keyboardListener);
|
this.jsPsych.pluginAPI.cancelKeyboardResponse(keyboardListener);
|
||||||
@ -218,9 +215,6 @@ class IatImagePlugin implements JsPsychPlugin<Info> {
|
|||||||
correct: response.correct,
|
correct: response.correct,
|
||||||
};
|
};
|
||||||
|
|
||||||
// clears the display
|
|
||||||
display_element.innerHTML = "";
|
|
||||||
|
|
||||||
// move on to the next trial
|
// move on to the next trial
|
||||||
this.jsPsych.finishTrial(trial_data);
|
this.jsPsych.finishTrial(trial_data);
|
||||||
};
|
};
|
||||||
|
@ -270,9 +270,6 @@ class ImageButtonResponsePlugin implements JsPsychPlugin<Info> {
|
|||||||
|
|
||||||
// function to end trial when it is time
|
// function to end trial when it is time
|
||||||
const end_trial = () => {
|
const end_trial = () => {
|
||||||
// kill any remaining setTimeout handlers
|
|
||||||
this.jsPsych.pluginAPI.clearAllTimeouts();
|
|
||||||
|
|
||||||
// gather the data to store for the trial
|
// gather the data to store for the trial
|
||||||
var trial_data = {
|
var trial_data = {
|
||||||
rt: response.rt,
|
rt: response.rt,
|
||||||
@ -280,9 +277,6 @@ class ImageButtonResponsePlugin implements JsPsychPlugin<Info> {
|
|||||||
response: response.button,
|
response: response.button,
|
||||||
};
|
};
|
||||||
|
|
||||||
// clear the display
|
|
||||||
display_element.innerHTML = "";
|
|
||||||
|
|
||||||
// move on to the next trial
|
// move on to the next trial
|
||||||
this.jsPsych.finishTrial(trial_data);
|
this.jsPsych.finishTrial(trial_data);
|
||||||
};
|
};
|
||||||
|
@ -215,9 +215,6 @@ class ImageKeyboardResponsePlugin implements JsPsychPlugin<Info> {
|
|||||||
|
|
||||||
// function to end trial when it is time
|
// function to end trial when it is time
|
||||||
const end_trial = () => {
|
const end_trial = () => {
|
||||||
// kill any remaining setTimeout handlers
|
|
||||||
this.jsPsych.pluginAPI.clearAllTimeouts();
|
|
||||||
|
|
||||||
// kill keyboard listeners
|
// kill keyboard listeners
|
||||||
if (typeof keyboardListener !== "undefined") {
|
if (typeof keyboardListener !== "undefined") {
|
||||||
this.jsPsych.pluginAPI.cancelKeyboardResponse(keyboardListener);
|
this.jsPsych.pluginAPI.cancelKeyboardResponse(keyboardListener);
|
||||||
@ -230,9 +227,6 @@ class ImageKeyboardResponsePlugin implements JsPsychPlugin<Info> {
|
|||||||
response: response.key,
|
response: response.key,
|
||||||
};
|
};
|
||||||
|
|
||||||
// clear the display
|
|
||||||
display_element.innerHTML = "";
|
|
||||||
|
|
||||||
// move on to the next trial
|
// move on to the next trial
|
||||||
this.jsPsych.finishTrial(trial_data);
|
this.jsPsych.finishTrial(trial_data);
|
||||||
};
|
};
|
||||||
|
@ -391,8 +391,6 @@ class ImageSliderResponsePlugin implements JsPsychPlugin<Info> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const end_trial = () => {
|
const end_trial = () => {
|
||||||
this.jsPsych.pluginAPI.clearAllTimeouts();
|
|
||||||
|
|
||||||
// save data
|
// save data
|
||||||
var trialdata = {
|
var trialdata = {
|
||||||
rt: response.rt,
|
rt: response.rt,
|
||||||
@ -401,8 +399,6 @@ class ImageSliderResponsePlugin implements JsPsychPlugin<Info> {
|
|||||||
response: response.response,
|
response: response.response,
|
||||||
};
|
};
|
||||||
|
|
||||||
display_element.innerHTML = "";
|
|
||||||
|
|
||||||
// next trial
|
// next trial
|
||||||
this.jsPsych.finishTrial(trialdata);
|
this.jsPsych.finishTrial(trialdata);
|
||||||
};
|
};
|
||||||
|
@ -76,7 +76,6 @@ class InitializeCameraPlugin implements JsPsychPlugin<Info> {
|
|||||||
|
|
||||||
trial(display_element: HTMLElement, trial: TrialType<Info>) {
|
trial(display_element: HTMLElement, trial: TrialType<Info>) {
|
||||||
this.run_trial(display_element, trial).then((id) => {
|
this.run_trial(display_element, trial).then((id) => {
|
||||||
display_element.innerHTML = "";
|
|
||||||
this.jsPsych.finishTrial({
|
this.jsPsych.finishTrial({
|
||||||
device_id: id,
|
device_id: id,
|
||||||
});
|
});
|
||||||
|
@ -225,8 +225,6 @@ class InstructionsPlugin implements JsPsychPlugin<Info> {
|
|||||||
this.jsPsych.pluginAPI.cancelKeyboardResponse(keyboard_listener);
|
this.jsPsych.pluginAPI.cancelKeyboardResponse(keyboard_listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
display_element.innerHTML = "";
|
|
||||||
|
|
||||||
var trial_data = {
|
var trial_data = {
|
||||||
view_history: view_history,
|
view_history: view_history,
|
||||||
rt: Math.round(performance.now() - start_time),
|
rt: Math.round(performance.now() - start_time),
|
||||||
|
@ -229,9 +229,6 @@ class MaxdiffPlugin implements JsPsychPlugin<Info> {
|
|||||||
response: { left: get_response("left"), right: get_response("right") },
|
response: { left: get_response("left"), right: get_response("right") },
|
||||||
};
|
};
|
||||||
|
|
||||||
// clear the display
|
|
||||||
display_element.innerHTML = "";
|
|
||||||
|
|
||||||
// next trial
|
// next trial
|
||||||
this.jsPsych.finishTrial(trial_data);
|
this.jsPsych.finishTrial(trial_data);
|
||||||
});
|
});
|
||||||
|
@ -85,7 +85,6 @@ class MirrorCameraPlugin implements JsPsychPlugin<Info> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
finish(display_element: HTMLElement) {
|
finish(display_element: HTMLElement) {
|
||||||
display_element.innerHTML = "";
|
|
||||||
this.jsPsych.finishTrial({
|
this.jsPsych.finishTrial({
|
||||||
rt: performance.now() - this.start_time,
|
rt: performance.now() - this.start_time,
|
||||||
});
|
});
|
||||||
|
@ -280,8 +280,6 @@ class PreloadPlugin implements JsPsychPlugin<Info> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const end_trial = () => {
|
const end_trial = () => {
|
||||||
// clear timeout again when end_trial is called, to handle race condition with max_load_time
|
|
||||||
this.jsPsych.pluginAPI.clearAllTimeouts();
|
|
||||||
var trial_data = {
|
var trial_data = {
|
||||||
success: success,
|
success: success,
|
||||||
timeout: timeout,
|
timeout: timeout,
|
||||||
@ -289,8 +287,7 @@ class PreloadPlugin implements JsPsychPlugin<Info> {
|
|||||||
failed_audio: failed_audio,
|
failed_audio: failed_audio,
|
||||||
failed_video: failed_video,
|
failed_video: failed_video,
|
||||||
};
|
};
|
||||||
// clear the display
|
|
||||||
display_element.innerHTML = "";
|
|
||||||
this.jsPsych.finishTrial(trial_data);
|
this.jsPsych.finishTrial(trial_data);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -91,8 +91,6 @@ class ReconstructionPlugin implements JsPsychPlugin<Info> {
|
|||||||
start_value: trial.starting_value,
|
start_value: trial.starting_value,
|
||||||
};
|
};
|
||||||
|
|
||||||
display_element.innerHTML = "";
|
|
||||||
|
|
||||||
// next trial
|
// next trial
|
||||||
this.jsPsych.finishTrial(trial_data);
|
this.jsPsych.finishTrial(trial_data);
|
||||||
};
|
};
|
||||||
|
@ -104,9 +104,6 @@ class ResizePlugin implements JsPsychPlugin<Info> {
|
|||||||
document.removeEventListener("mousemove", resizeevent);
|
document.removeEventListener("mousemove", resizeevent);
|
||||||
document.removeEventListener("mouseup", mouseupevent);
|
document.removeEventListener("mouseup", mouseupevent);
|
||||||
|
|
||||||
// clear the screen
|
|
||||||
display_element.innerHTML = "";
|
|
||||||
|
|
||||||
// finishes trial
|
// finishes trial
|
||||||
|
|
||||||
var trial_data = {
|
var trial_data = {
|
||||||
|
@ -139,9 +139,6 @@ class SameDifferentHtmlPlugin implements JsPsychPlugin<Info> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const after_response = (info: { key: string; rt: number }) => {
|
const after_response = (info: { key: string; rt: number }) => {
|
||||||
// kill any remaining setTimeout handlers
|
|
||||||
this.jsPsych.pluginAPI.clearAllTimeouts();
|
|
||||||
|
|
||||||
var correct = false;
|
var correct = false;
|
||||||
|
|
||||||
var skey = trial.same_key;
|
var skey = trial.same_key;
|
||||||
@ -167,8 +164,6 @@ class SameDifferentHtmlPlugin implements JsPsychPlugin<Info> {
|
|||||||
trial_data["response_stim1"] = first_stim_info.key;
|
trial_data["response_stim1"] = first_stim_info.key;
|
||||||
}
|
}
|
||||||
|
|
||||||
display_element.innerHTML = "";
|
|
||||||
|
|
||||||
this.jsPsych.finishTrial(trial_data);
|
this.jsPsych.finishTrial(trial_data);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -142,9 +142,6 @@ class SameDifferentImagePlugin implements JsPsychPlugin<Info> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const after_response = (info: { key: string; rt: number }) => {
|
const after_response = (info: { key: string; rt: number }) => {
|
||||||
// kill any remaining setTimeout handlers
|
|
||||||
this.jsPsych.pluginAPI.clearAllTimeouts();
|
|
||||||
|
|
||||||
var correct = false;
|
var correct = false;
|
||||||
|
|
||||||
var skey = trial.same_key;
|
var skey = trial.same_key;
|
||||||
@ -170,8 +167,6 @@ class SameDifferentImagePlugin implements JsPsychPlugin<Info> {
|
|||||||
trial_data["response_stim1"] = first_stim_info.key;
|
trial_data["response_stim1"] = first_stim_info.key;
|
||||||
}
|
}
|
||||||
|
|
||||||
display_element.innerHTML = "";
|
|
||||||
|
|
||||||
this.jsPsych.finishTrial(trial_data);
|
this.jsPsych.finishTrial(trial_data);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -177,9 +177,6 @@ class SerialReactionTimeMousePlugin implements JsPsychPlugin<Info> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const endTrial = () => {
|
const endTrial = () => {
|
||||||
// kill any remaining setTimeout handlers
|
|
||||||
this.jsPsych.pluginAPI.clearAllTimeouts();
|
|
||||||
|
|
||||||
// gather the data to store for the trial
|
// gather the data to store for the trial
|
||||||
var trial_data = {
|
var trial_data = {
|
||||||
rt: response.rt,
|
rt: response.rt,
|
||||||
@ -189,9 +186,6 @@ class SerialReactionTimeMousePlugin implements JsPsychPlugin<Info> {
|
|||||||
correct: response.row == trial.target[0] && response.column == trial.target[1],
|
correct: response.row == trial.target[0] && response.column == trial.target[1],
|
||||||
};
|
};
|
||||||
|
|
||||||
// clear the display
|
|
||||||
display_element.innerHTML = "";
|
|
||||||
|
|
||||||
// move on to the next trial
|
// move on to the next trial
|
||||||
this.jsPsych.finishTrial(trial_data);
|
this.jsPsych.finishTrial(trial_data);
|
||||||
};
|
};
|
||||||
|
@ -133,9 +133,6 @@ class SerialReactionTimePlugin implements JsPsychPlugin<Info> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const endTrial = () => {
|
const endTrial = () => {
|
||||||
// kill any remaining setTimeout handlers
|
|
||||||
this.jsPsych.pluginAPI.clearAllTimeouts();
|
|
||||||
|
|
||||||
// kill keyboard listeners
|
// kill keyboard listeners
|
||||||
this.jsPsych.pluginAPI.cancelKeyboardResponse(keyboardListener);
|
this.jsPsych.pluginAPI.cancelKeyboardResponse(keyboardListener);
|
||||||
|
|
||||||
@ -148,9 +145,6 @@ class SerialReactionTimePlugin implements JsPsychPlugin<Info> {
|
|||||||
target: trial.target,
|
target: trial.target,
|
||||||
};
|
};
|
||||||
|
|
||||||
// clear the display
|
|
||||||
display_element.innerHTML = "";
|
|
||||||
|
|
||||||
// move on to the next trial
|
// move on to the next trial
|
||||||
this.jsPsych.finishTrial(trial_data);
|
this.jsPsych.finishTrial(trial_data);
|
||||||
};
|
};
|
||||||
|
@ -709,7 +709,6 @@ class SketchpadPlugin implements JsPsychPlugin<Info> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private end_trial(response = null) {
|
private end_trial(response = null) {
|
||||||
this.jsPsych.pluginAPI.clearAllTimeouts();
|
|
||||||
this.jsPsych.pluginAPI.cancelAllKeyboardResponses();
|
this.jsPsych.pluginAPI.cancelAllKeyboardResponses();
|
||||||
clearInterval(this.timer_interval);
|
clearInterval(this.timer_interval);
|
||||||
|
|
||||||
@ -726,8 +725,6 @@ class SketchpadPlugin implements JsPsychPlugin<Info> {
|
|||||||
trial_data.strokes = this.strokes;
|
trial_data.strokes = this.strokes;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.display.innerHTML = "";
|
|
||||||
|
|
||||||
document.querySelector("#sketchpad-styles").remove();
|
document.querySelector("#sketchpad-styles").remove();
|
||||||
|
|
||||||
this.jsPsych.finishTrial(trial_data);
|
this.jsPsych.finishTrial(trial_data);
|
||||||
|
@ -141,8 +141,6 @@ class SurveyHtmlFormPlugin implements JsPsychPlugin<Info> {
|
|||||||
response: question_data,
|
response: question_data,
|
||||||
};
|
};
|
||||||
|
|
||||||
display_element.innerHTML = "";
|
|
||||||
|
|
||||||
// next trial
|
// next trial
|
||||||
this.jsPsych.finishTrial(trialdata);
|
this.jsPsych.finishTrial(trialdata);
|
||||||
});
|
});
|
||||||
|
@ -229,8 +229,6 @@ class SurveyLikertPlugin implements JsPsychPlugin<Info> {
|
|||||||
question_order: question_order,
|
question_order: question_order,
|
||||||
};
|
};
|
||||||
|
|
||||||
display_element.innerHTML = "";
|
|
||||||
|
|
||||||
// next trial
|
// next trial
|
||||||
this.jsPsych.finishTrial(trial_data);
|
this.jsPsych.finishTrial(trial_data);
|
||||||
});
|
});
|
||||||
|
@ -264,7 +264,6 @@ class SurveyMultiChoicePlugin implements JsPsychPlugin<Info> {
|
|||||||
response: question_data,
|
response: question_data,
|
||||||
question_order: question_order,
|
question_order: question_order,
|
||||||
};
|
};
|
||||||
display_element.innerHTML = "";
|
|
||||||
|
|
||||||
// next trial
|
// next trial
|
||||||
this.jsPsych.finishTrial(trial_data);
|
this.jsPsych.finishTrial(trial_data);
|
||||||
|
@ -299,7 +299,6 @@ class SurveyMultiSelectPlugin implements JsPsychPlugin<Info> {
|
|||||||
response: question_data,
|
response: question_data,
|
||||||
question_order: question_order,
|
question_order: question_order,
|
||||||
};
|
};
|
||||||
display_element.innerHTML = "";
|
|
||||||
|
|
||||||
// next trial
|
// next trial
|
||||||
this.jsPsych.finishTrial(trial_data);
|
this.jsPsych.finishTrial(trial_data);
|
||||||
|
@ -256,8 +256,6 @@ class SurveyTextPlugin implements JsPsychPlugin<Info> {
|
|||||||
response: question_data,
|
response: question_data,
|
||||||
};
|
};
|
||||||
|
|
||||||
display_element.innerHTML = "";
|
|
||||||
|
|
||||||
// next trial
|
// next trial
|
||||||
this.jsPsych.finishTrial(trialdata);
|
this.jsPsych.finishTrial(trialdata);
|
||||||
});
|
});
|
||||||
|
@ -194,7 +194,6 @@ class SurveyPlugin implements JsPsychPlugin<Info> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// clear display and reset flex on jspsych-content-wrapper
|
// clear display and reset flex on jspsych-content-wrapper
|
||||||
display_element.innerHTML = "";
|
|
||||||
document.querySelector<HTMLElement>(".jspsych-content-wrapper").style.display = "flex";
|
document.querySelector<HTMLElement>(".jspsych-content-wrapper").style.display = "flex";
|
||||||
|
|
||||||
// finish trial and save data
|
// finish trial and save data
|
||||||
|
@ -187,8 +187,6 @@ class VideoButtonResponsePlugin implements JsPsychPlugin<Info> {
|
|||||||
constructor(private jsPsych: JsPsych) {}
|
constructor(private jsPsych: JsPsych) {}
|
||||||
|
|
||||||
trial(display_element: HTMLElement, trial: TrialType<Info>) {
|
trial(display_element: HTMLElement, trial: TrialType<Info>) {
|
||||||
display_element.innerHTML = "";
|
|
||||||
|
|
||||||
// Setup stimulus
|
// Setup stimulus
|
||||||
const stimulusWrapper = document.createElement("div");
|
const stimulusWrapper = document.createElement("div");
|
||||||
display_element.appendChild(stimulusWrapper);
|
display_element.appendChild(stimulusWrapper);
|
||||||
@ -361,9 +359,6 @@ class VideoButtonResponsePlugin implements JsPsychPlugin<Info> {
|
|||||||
|
|
||||||
// function to end trial when it is time
|
// function to end trial when it is time
|
||||||
const end_trial = () => {
|
const end_trial = () => {
|
||||||
// kill any remaining setTimeout handlers
|
|
||||||
this.jsPsych.pluginAPI.clearAllTimeouts();
|
|
||||||
|
|
||||||
// stop the video file if it is playing
|
// stop the video file if it is playing
|
||||||
// remove any remaining end event handlers
|
// remove any remaining end event handlers
|
||||||
videoElement.pause();
|
videoElement.pause();
|
||||||
@ -376,9 +371,6 @@ class VideoButtonResponsePlugin implements JsPsychPlugin<Info> {
|
|||||||
response: response.button,
|
response: response.button,
|
||||||
};
|
};
|
||||||
|
|
||||||
// clear the display
|
|
||||||
display_element.innerHTML = "";
|
|
||||||
|
|
||||||
// move on to the next trial
|
// move on to the next trial
|
||||||
this.jsPsych.finishTrial(trial_data);
|
this.jsPsych.finishTrial(trial_data);
|
||||||
};
|
};
|
||||||
|
@ -278,9 +278,6 @@ class VideoKeyboardResponsePlugin implements JsPsychPlugin<Info> {
|
|||||||
|
|
||||||
// function to end trial when it is time
|
// function to end trial when it is time
|
||||||
const end_trial = () => {
|
const end_trial = () => {
|
||||||
// kill any remaining setTimeout handlers
|
|
||||||
this.jsPsych.pluginAPI.clearAllTimeouts();
|
|
||||||
|
|
||||||
// kill keyboard listeners
|
// kill keyboard listeners
|
||||||
this.jsPsych.pluginAPI.cancelAllKeyboardResponses();
|
this.jsPsych.pluginAPI.cancelAllKeyboardResponses();
|
||||||
|
|
||||||
@ -300,9 +297,6 @@ class VideoKeyboardResponsePlugin implements JsPsychPlugin<Info> {
|
|||||||
response: response.key,
|
response: response.key,
|
||||||
};
|
};
|
||||||
|
|
||||||
// clear the display
|
|
||||||
display_element.innerHTML = "";
|
|
||||||
|
|
||||||
// move on to the next trial
|
// move on to the next trial
|
||||||
this.jsPsych.finishTrial(trial_data);
|
this.jsPsych.finishTrial(trial_data);
|
||||||
};
|
};
|
||||||
|
@ -400,9 +400,6 @@ class VideoSliderResponsePlugin implements JsPsychPlugin<Info> {
|
|||||||
|
|
||||||
// function to end trial when it is time
|
// function to end trial when it is time
|
||||||
const end_trial = () => {
|
const end_trial = () => {
|
||||||
// kill any remaining setTimeout handlers
|
|
||||||
this.jsPsych.pluginAPI.clearAllTimeouts();
|
|
||||||
|
|
||||||
// stop the video file if it is playing
|
// stop the video file if it is playing
|
||||||
// remove any remaining end event handlers
|
// remove any remaining end event handlers
|
||||||
display_element
|
display_element
|
||||||
@ -421,9 +418,6 @@ class VideoSliderResponsePlugin implements JsPsychPlugin<Info> {
|
|||||||
response: response.response,
|
response: response.response,
|
||||||
};
|
};
|
||||||
|
|
||||||
// clear the display
|
|
||||||
display_element.innerHTML = "";
|
|
||||||
|
|
||||||
// move on to the next trial
|
// move on to the next trial
|
||||||
this.jsPsych.finishTrial(trial_data);
|
this.jsPsych.finishTrial(trial_data);
|
||||||
};
|
};
|
||||||
|
@ -498,9 +498,6 @@ class VirtualChinrestPlugin implements JsPsychPlugin<Info> {
|
|||||||
// compute final data
|
// compute final data
|
||||||
computeTransformation();
|
computeTransformation();
|
||||||
|
|
||||||
// clear the display
|
|
||||||
display_element.innerHTML = "";
|
|
||||||
|
|
||||||
// finish the trial
|
// finish the trial
|
||||||
this.jsPsych.finishTrial(trial_data);
|
this.jsPsych.finishTrial(trial_data);
|
||||||
};
|
};
|
||||||
|
@ -201,9 +201,6 @@ class VisualSearchCirclePlugin implements JsPsychPlugin<Info> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const end_trial = () => {
|
const end_trial = () => {
|
||||||
display_element.innerHTML = "";
|
|
||||||
|
|
||||||
this.jsPsych.pluginAPI.clearAllTimeouts();
|
|
||||||
this.jsPsych.pluginAPI.cancelAllKeyboardResponses();
|
this.jsPsych.pluginAPI.cancelAllKeyboardResponses();
|
||||||
|
|
||||||
// data saving
|
// data saving
|
||||||
|
@ -178,15 +178,9 @@ class WebgazerCalibratePlugin implements JsPsychPlugin<Info> {
|
|||||||
extension.hidePredictions();
|
extension.hidePredictions();
|
||||||
extension.hideVideo();
|
extension.hideVideo();
|
||||||
|
|
||||||
// kill any remaining setTimeout handlers
|
|
||||||
this.jsPsych.pluginAPI.clearAllTimeouts();
|
|
||||||
|
|
||||||
// gather the data to store for the trial
|
// gather the data to store for the trial
|
||||||
var trial_data = {};
|
var trial_data = {};
|
||||||
|
|
||||||
// clear the display
|
|
||||||
display_element.innerHTML = "";
|
|
||||||
|
|
||||||
// move on to the next trial
|
// move on to the next trial
|
||||||
this.jsPsych.finishTrial(trial_data);
|
this.jsPsych.finishTrial(trial_data);
|
||||||
};
|
};
|
||||||
|
@ -61,17 +61,11 @@ class WebgazerInitCameraPlugin implements JsPsychPlugin<Info> {
|
|||||||
extension.pause();
|
extension.pause();
|
||||||
extension.hideVideo();
|
extension.hideVideo();
|
||||||
|
|
||||||
// kill any remaining setTimeout handlers
|
|
||||||
this.jsPsych.pluginAPI.clearAllTimeouts();
|
|
||||||
|
|
||||||
// gather the data to store for the trial
|
// gather the data to store for the trial
|
||||||
var trial_data = {
|
var trial_data = {
|
||||||
load_time: load_time,
|
load_time: load_time,
|
||||||
};
|
};
|
||||||
|
|
||||||
// clear the display
|
|
||||||
display_element.innerHTML = "";
|
|
||||||
|
|
||||||
document.querySelector("#webgazer-center-style").remove();
|
document.querySelector("#webgazer-center-style").remove();
|
||||||
|
|
||||||
// move on to the next trial
|
// move on to the next trial
|
||||||
|
@ -146,12 +146,6 @@ class WebgazerValidatePlugin implements JsPsychPlugin<Info> {
|
|||||||
const end_trial = () => {
|
const end_trial = () => {
|
||||||
extension.stopSampleInterval();
|
extension.stopSampleInterval();
|
||||||
|
|
||||||
// kill any remaining setTimeout handlers
|
|
||||||
this.jsPsych.pluginAPI.clearAllTimeouts();
|
|
||||||
|
|
||||||
// clear the display
|
|
||||||
display_element.innerHTML = "";
|
|
||||||
|
|
||||||
// move on to the next trial
|
// move on to the next trial
|
||||||
this.jsPsych.finishTrial(trial_data);
|
this.jsPsych.finishTrial(trial_data);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user