Skip to content

Commit

Permalink
ref: Pass photodiodeGhostBox as a const instead of function
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertGemmaJr committed Dec 12, 2023
1 parent 5a3f2ce commit 2ae8b3c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
15 changes: 5 additions & 10 deletions src/lib/markup/photodiode.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,11 @@ import { div, span } from "./tags";
* Markup for a box in the bottom right corner of the screen and a photodiode spot inside the ghost box
* Note the box will only be visible if USE_PHOTODIODE is true
*/
// TODO: Make constant
// TODO #355: Conditional check should be at the task level
function photodiodeGhostBox() {
const spot = span("", { id: "photodiode-spot", class: "photodiode-spot" });
return div(spot, {
id: "photodiode-box",
// Photodiode is only visible if config.USE_PHOTODIODE is true
class: config.USE_PHOTODIODE ? "photodiode-box visible" : "photodiode-box invisible",
});
}
const photodiodeGhostBox = div(span("", { id: "photodiode-spot", class: "photodiode-spot" }), {
id: "photodiode-box",
// Photodiode is only visible if config.USE_PHOTODIODE is true
class: config.USE_PHOTODIODE ? "photodiode-box visible" : "photodiode-box invisible",
});

/**
* Conditionally flashes a spot inside the photodiodeGhostBox
Expand Down
2 changes: 1 addition & 1 deletion src/timelines/honeycombBlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function buildHoneycombBlock(jsPsych) {
stimulus: jsPsych.timelineVariable("stimulus"),
// Conditionally displays the photodiodeGhostBox
prompt: () => {
if (config.USE_PHOTODIODE) return photodiodeGhostBox();
if (config.USE_PHOTODIODE) return photodiodeGhostBox;
else return null;
},
// Possible choices are the correct_responses from the task settings
Expand Down
2 changes: 1 addition & 1 deletion src/trials/fixation.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function buildFixationTrial(jsPsych) {
stimulus: div(div("", { id: "fixation-dot" }), { class: "center_container" }),
// Conditionally display the photodiodeGhostBox
prompt: () => {
if (config.USE_PHOTODIODE) return photodiodeGhostBox();
if (config.USE_PHOTODIODE) return photodiodeGhostBox;
else return null;
},
response_ends_trial: false,
Expand Down

0 comments on commit 2ae8b3c

Please sign in to comment.