Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Commit

Permalink
Merge pull request #39 from benjamin-heasly/jspsych-7-upgrade
Browse files Browse the repository at this point in the history
Jspsych 7 upgrade
  • Loading branch information
benjamin-heasly authored Jul 7, 2022
2 parents 912a9c8 + 8e05bf2 commit 72cc81b
Show file tree
Hide file tree
Showing 25 changed files with 27,782 additions and 8,312 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,5 @@ jobs:
- name: Install dependencies
run: yarn install

- name: Build Assets
run: yarn build

- name: Test
run: yarn test
3 changes: 0 additions & 3 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ jobs:
- name: Install dependencies
run: yarn install

- name: Build Assets
run: yarn build

- name: Test
run: yarn test

Expand Down
8 changes: 4 additions & 4 deletions Documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Builds a multi choice/select survey trial.
| Param | Type | Description |
| --- | --- | --- |
| options | <code>Object</code> | |
| options.responseType | <code>string</code> | This tells jsPsych which plugin file to use to run the trial. (default: 'survey_multi_choice') |
| options.responseType | <code>string</code> | This tells jsPsych which plugin file to use to run the trial. (default: surveyMultiChoice from "@jspsych/plugin-survey-multi-choice") |
| options.preamble | <code>string</code> | HTML formatted string to display at the top of the page above all the questions. (default: "") |
| options.prompts | <code>Array</code> | The question prompts, an Array of strings (default: []) |
| options.ansChoices | <code>Object</code> | Object consisting of the key as the answer choice name and value as the array of answer choices. (default: {}) |
Expand Down Expand Up @@ -112,15 +112,15 @@ Builds a trial with a onscreen message, optional buttons and optional photodiode
| config.USE_ELECTRON | <code>boolean</code> | USE_ELECTRON flag |
| config.USE_MTURK | <code>boolean</code> | USE_MTURK flag |
| options | <code>Object</code> | |
| options.responseType | <code>string</code> | This tells jsPsych which plugin file to use to run the trial. (default: 'html_keyboard_response') |
| options.duration | <code>number</code> | trial duration in milliseconds, only to be specified if the options.responseType is html_keyboard_response. (default: 1000, if options.responseType === html_keyboard_response, otherwise ignored) |
| options.responseType | <code>string</code> | This tells jsPsych which plugin file to use to run the trial. (default: htmlKeyboardResponse from "@jspsych/plugin-html-keyboard-response") |
| options.duration | <code>number</code> | trial duration in milliseconds, only to be specified if the options.responseType is htmlKeyboardResponse. (default: 1000, if options.responseType is htmlKeyboardResponse, otherwise ignored) |
| options.stimulus | <code>string</code> | Onscreen stimulus in HTML to be shown in the trial, if not set default text is empty. If the stimulus is not provided, message should be provided as a string. (default: "") |
| options.message | <code>string</code> | Onscreen message to be shown in the trial. (default: "") |
| options.onstart | <code>boolean</code> | True if the message is to be display on start of the trial. False if the message needs to be in the stimulus.(default: false) |
| options.responseEndsTrial | <code>boolean</code> | True if the trial ends on response,false if the trial waits for the duration. (default: false) |
| options.taskCode | <code>number</code> | Task code to be saved into data log (default: 1) |
| options.numBlinks | <code>number</code> | Number of times the pulse needs to be repeated for photodiode box, when USE_PHOTODIODE is set true. (default: 1) |
| options.buttons | <code>Array</code> | This array contains the keys that the subject is allowed to press in order to respond to the stimulus. Keys can be specified as their numeric key code or as characters (e.g., 'a', 'q'). The default value of jsPsych.ALL_KEYS means that all keys will be accepted as valid responses. Specifying jsPsych.NO_KEYS will mean that no responses are allowed. Only to be specified if the options.responseType is html_button_response (default: ["OK"], if options.responseType === html_button_response, otherwise ignored) |
| options.buttons | <code>Array</code> | This array contains the keys that the subject is allowed to press in order to respond to the stimulus. Keys can be specified as their numeric key code or as characters (e.g., 'a', 'q'). The default value of "ALL_KEYS" means that all keys will be accepted as valid responses. Specifying "NO_KEYS" will mean that no responses are allowed. Only to be specified if the options.responseType is htmlButtonResponse from "@jspsych/plugin-html-button-response" (default: ["OK"], if options.responseType is htmlButtonResponse, otherwise ignored) |

<a name="module_slider"></a>

Expand Down
39 changes: 24 additions & 15 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
const _ = require('lodash')
import { extend } from 'lodash';
import { countdown } from './trials/countdown';
import { showMessage } from './trials/showMessage';
import { fixation } from './trials/fixation';
import { userId } from './trials/userId';
import { showImage } from './trials/showImage';
import { slider } from './trials/slider';
import { survey } from './trials/survey';
import { multiSurvey } from './trials/multiSurvey';

const defaultconfig = { USE_PHOTODIODE: false, USE_EEG: false, USE_ELECTRON: true, USE_MTURK: false}
const defaultconfig = { USE_PHOTODIODE: false, USE_EEG: false, USE_ELECTRON: true, USE_MTURK: false }

function init(_config) {
return extend(defaultconfig, _config)
}

module.exports = {
init: function(_config){
return _.extend(defaultconfig,_config)
},
countdown: require('./trials/countdown.js'),
showMessage: require('./trials/showMessage.js'),
fixation: require('./trials/fixation.js'),
userId: require('./trials/userId.js'),
showImage: require('./trials/showImage.js'),
slider: require('./trials/slider.js'),
survey: require('./trials/survey.js'),
multiSurvey: require('./trials/multiSurvey.js')
};
export {
init,
countdown,
showMessage,
fixation,
userId,
showImage,
slider,
survey,
multiSurvey
};
1 change: 1 addition & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {presets: ['@babel/preset-env']}
2 changes: 1 addition & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ const jitterx = (base, offset) => (
base + Math.floor(Math.random() * Math.floor(offset))
)

module.exports ={
export {
jitterx
}
Loading

0 comments on commit 72cc81b

Please sign in to comment.