Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add: callFunction trial to call setUpPort after holdupMarkerTrial #515

Closed
wants to merge 120 commits into from

Conversation

YUUU23
Copy link
Contributor

@YUUU23 YUUU23 commented Jul 26, 2024

  • callFunction.js: JSPsych trial that calls function passed in
  • startProcedure.js: calls buildCallFunctionTrial in callFunction.js passing in checkSerialPort() that access the electron process to call setUpPort() after holdUpMarkerTrial

RobertGemmaJr and others added 30 commits April 5, 2024 16:48
feat: Upgrade react react-bootstrap
BREAKING CHANGE: Deprecate PsiTurk
Copy link

github-actions bot commented Jul 26, 2024

Visit the preview URL for this PR (updated for commit 29d7c01):

https://ccv-honeycomb--pr515-add-callfunction-35azeh52.web.app

(expires Wed, 07 Aug 2024 20:34:32 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 4ace1dcea913a952d2a1af84b94a4421bf36e610

@YUUU23 YUUU23 requested a review from RobertGemmaJr July 26, 2024 05:50
@YUUU23 YUUU23 self-assigned this Jul 26, 2024
@YUUU23 YUUU23 added 4.0 Versioning: Issue in regards to version 4.0.0 release 3.4 Versioning: Issue in regards to version 3.4 release and removed 4.0 Versioning: Issue in regards to version 4.0.0 release labels Jul 26, 2024
Copy link
Member

@RobertGemmaJr RobertGemmaJr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fantastic! The structure of the code is excellent. Just a minor thing about how JS executes the callback functions and you'll be on your way!

package.json Outdated
@@ -26,6 +26,7 @@
"@electron/fuses": "^1.8.0",
"@fortawesome/fontawesome-free": "^6.4.2",
"@jspsych/plugin-audio-keyboard-response": "^1.1.3",
"@jspsych/plugin-call-function": "^2.0.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey! Can you actually set this to be version ^1.1.0? jsPsych just released a new version and all of their plugins have been updated as well, we want the one that's major version #1

Suggested change
"@jspsych/plugin-call-function": "^2.0.0",
"@jspsych/plugin-call-function": "^2.0.0",

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! I love the way you added it as a parameter

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!!

Comment on lines 12 to 14
func: () => {
func;
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Little oddness of JavaScript here! Because we're passing a callback function to the property func we actually need to supply a callback function, and not just the call to the function itself. There's a couple ways that we can do this:

Suggested change
func: () => {
func;
},
// 1) This way is best
func: func,
// 2) Or this would work too
func: () => {
func()
},

Notice how with option 2 we cannot pass any parameters to the function - even if we define them in startProcedure.js! Because of this I would go with option 1, and then in startProcedure you pass a callback function to the code we actually want to execute:

procedure.push(buildCallFunctionTrial(() => { window.electronAPI.checkSerialPort() }));

@YUUU23 YUUU23 requested a review from RobertGemmaJr July 31, 2024 20:12
@YUUU23 YUUU23 changed the base branch from feat-v4 to feat-v3.4.2 July 31, 2024 20:14
@YUUU23
Copy link
Contributor Author

YUUU23 commented Jul 31, 2024

Please see this PR #524 for the change of merging it into 3.4.2 instead!

@YUUU23 YUUU23 closed this Aug 1, 2024
@YUUU23
Copy link
Contributor Author

YUUU23 commented Aug 1, 2024

Same code merged here #524

@YUUU23 YUUU23 deleted the add-callFunction branch August 1, 2024 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.4 Versioning: Issue in regards to version 3.4 release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor holdUpMarker as a basic trial for lining up the photodiode spot
2 participants