Commit Graph

2493 Commits

Author SHA1 Message Date
bjoluc
6006fec96a Prepare @jspsych/config for external use 2021-08-25 21:57:28 +02:00
Josh de Leeuw
b0d77e79aa
Merge pull request #2100 from jspsych/modularization-getters
modularization-getters
2021-08-23 14:19:22 -04:00
Josh de Leeuw
5d060f6b96 rename getter methods, update docs 2021-08-23 13:11:32 -04:00
bjoluc
2b82cab264 Remove outdated import in test-extension.ts 2021-08-22 00:33:00 +02:00
bjoluc
bb141c446a Fix class instance access in callback functions
by converting the affected functions to arrow functions to preserve the
outer-scope `this`
2021-08-20 14:17:46 +02:00
bjoluc
ba9c495a21 Add .cjs extension to import-sort config 2021-08-20 11:39:09 +02:00
Josh de Leeuw
b3b9f5fd5e
Create modular versions of extensions (#2053)
Extensions are now passed to the `JsPsych` constructor via an `extensions` option.
Along the way, the webgazer plugins and plugin-html-button-response have been modularized as well.

Co-authored-by: bjoluc <mail@bjoluc.de>
Co-authored-by: Becky Gilbert <beckyannegilbert@gmail.com>
2021-08-20 11:15:33 +02:00
bjoluc
c340c5ea55 Enhance scripts in package.json files 2021-08-17 20:26:38 +02:00
bjoluc
b288a8e21f Move root Jest config into package.json 2021-08-17 18:58:59 +02:00
bjoluc
f54d48911f
Merge pull request #2084 from bjoluc/parameter-types
Enhance parameter types
2021-08-17 17:32:35 +02:00
bjoluc
9c519853fe Use enum for parameter types and remove JsPsych.plugins
`const parameterType` is now `enum ParameterType` and can only be
accessed by importing it.
2021-08-17 17:19:25 +02:00
bjoluc
743ad44e84 Replace ALL_KEYS and NO_KEYS with strings
`"ALL_KEYS"` is now used instead of `jsPsych.ALL_KEYS` and `"NO_KEYS"`
instead of `jsPsych.NO_KEYS`
2021-08-17 17:07:23 +02:00
bjoluc
2e17ca6b33 Introduce parameterType.KEYS for multiple keys
It represents an array of keys, or jsPsych.ALL_KEYS and jsPsych.NO_KEYS
2021-08-17 17:07:23 +02:00
bjoluc
5152f52977
Merge pull request #2079 from bjoluc/preload
Implement `preload` flag for plugin parameters
2021-08-17 17:01:18 +02:00
bjoluc
64541a451f Implement preload flag for plugin parameters
It defaults to `true` for parameters of type IMAGE, VIDEO, and AUDIO,
and is ignored for any other parameter type.
Example: Using `parameterType.IMAGE` for a parameter `param` in a
plugin named `my-plugin` is equivalent to calling
`jspsych.pluginAPI.registerPreload("my-plugin", "param", "image")`
before `jsPsych.run()`. Setting `preload: false` for the parameter would
disable this invocation.
2021-08-17 16:47:07 +02:00
bjoluc
105b041255 Configure husky to run prettier via lint-staged 2021-08-13 22:04:28 +02:00
bjoluc
017b45d87e Make trial_type a string in JsPsychData
I forgot to do this when migrating the core to use plugin objects.
@jansim was first with this in #661, so he gets the credits!

Closes #2076
Co-authored-by: Jan Simson <jan.simson@three-2-one.com>
2021-08-12 18:06:22 +02:00
bjoluc
56d6fd9d0b Make plugin info static
so it can be accessed before a plugin is instantiated
2021-08-12 17:25:26 +02:00
bjoluc
559f60c83e Add Gulp script to create a dist archive 2021-08-09 09:35:48 +02:00
bjoluc
c119650471 Move experiment execution into jsPsych.run()
The `run()` method takes a timeline and returns a promise that is
resolved when the experiment finishes.
Hence, jsPsych can now be initialized without starting an experiment.
This re-enables usage of `jsPsych.timelineVariable()` in timeline
definitions and repairs exclusion checks and extension loading.
2021-07-19 17:10:37 +02:00
bjoluc
82fa8e3f29 Add explicit include option to TS configs
So VS Code ignores the `dist` folders
2021-07-13 09:54:29 +02:00
bjoluc
8cfbba526a Use classes to avoid global state
Instead of a global `jsPsych` object, there is a `JsPsych` class now
which can be instantiated with the parameters that were previously
accepted by `jsPsych.init`. Upon instantiation, the `JsPsych` class also
instantiates classes for stateful modules (`jsPsych.data` and
`jsPsych.pluginAPI`) and passes relevant `JsPsych` instance information
to them. Plugins are expected to be classes now that are instantiated
for each trial and receive the `JsPsych` instance as their only
constructor argument.
2021-07-12 18:15:37 +02:00
bjoluc
1ec9d59305 Update GH Actions workflow for monorepo 2021-07-08 23:34:50 +02:00
bjoluc
9afacdfd90 Fix paths in TS configs 2021-07-08 23:32:30 +02:00
bjoluc
91e7b1e3ff Migrate to TypeScript 2021-07-06 17:55:42 +02:00
bjoluc
584a8879ef Highlight plugin projects in jest test runs 2021-07-01 13:07:28 +02:00
bjoluc
d12052c774 Decompose jspsych core into ES6 modules 2021-07-01 12:46:41 +02:00
bjoluc
83f449c635 Utilize jest's monorepo support 2021-06-30 19:29:38 +02:00
bjoluc
744e67b0a5 Setup monorepo and switch to ES6 modules
* Convert jsPsych and plugins to ES6 modules
* Create packages for each plugin, the core library, and config files
* Setup rollup, jest, and babel configurations
* Update jsPsych to load plugin objects directly from the `type` field
* Update tests to use the ES6 modules
2021-06-23 22:39:38 +02:00
Becky Gilbert
ae332b3347 added contributor nikbpetrov 2021-06-10 14:50:46 -07:00
Becky Gilbert
1436132d6d
Merge pull request #1880 from nikbpetrov/same-different-default-values-fix
Fixes stim duration default values in same-different plugins #1879
2021-06-10 14:44:22 -07:00
nikbpetrov
9d01f20d0c Same-different-html & same-different-image default values fix 2021-06-08 09:48:42 +01:00
nikbpetrov
ac3a386e99 Working: html-slider, image-sldier, instructions, image-button 2021-06-08 00:13:33 +01:00
nikbpetrov
012e9f9ba4 html-button-response working 2021-06-07 23:53:54 +01:00
nikbpetrov
3dbcd94ef0 Demo flanker working ++ updates to keyboard-response simulate methods ++ added remove_post_trial_gap to simluate_opts 2021-06-07 23:45:36 +01:00
nikbpetrov
8dc1959d13 jspsych-image-keyboard-repsonse simulate working 2021-06-07 23:21:43 +01:00
nikbpetrov
b3a8326c63
Merge pull request #1 from nikbpetrov/html-keyboard-response
Html keyboard response working
2021-06-07 23:05:15 +01:00
nikbpetrov
a550da1721 Html-keyboard-response seems to work 2021-06-07 23:04:24 +01:00
nikbpetrov
59d284306d _Temp save 2021-06-07 21:26:05 +01:00
nikbpetrov
85b1dc6ae2 Create examples with simulate folder 2021-06-07 20:06:57 +01:00
Becky Gilbert
e917fabb55 fix typo 2021-05-20 10:41:59 -07:00
Becky Gilbert
e7eb6a6f5e fix typo - fixes #1840 2021-05-20 10:16:29 -07:00
Becky Gilbert
316aa679fc fix error in docs example (missing comma) - fixes #1840 2021-05-19 14:41:08 -07:00
Becky Gilbert
b528c4663f Merge branch 'master' of https://github.com/jspsych/jsPsych 2021-05-18 15:22:15 -07:00
Becky Gilbert
dd9424c84d update version number from 6.3.0 to 6.3.1 - fixes #1835 2021-05-18 15:20:26 -07:00
Becky Gilbert
7681e5cb73
Merge pull request #1781 from moltaire/fix-validate-doc-title
Fixed jspsych-webgazer-validate plugin documentation title
2021-05-18 15:13:04 -07:00
Becky Gilbert
38286b108a
Merge pull request #1820 from AndrianV/patch-1
Fix incorrect parameter name (case_sensitive_responses) in experiment-options.md
2021-05-13 10:37:25 -07:00
Andrian Vangelov
21562d92eb
Update parameter name in experiment-options.md
Updated docs on "Choose whether you want keyboard choices/responses to be case-sensitive", where the mentioned "case_sensitive" parameter must be "case_sensitive_responses" instead, as it is otherwise correctly implemented and mentioned in other places in the documentation (e.g. "jspsych-pluginAPI.md" - starting at line 112 and "jspsych-core.md" at line 368). The "case_sensitive" variable is used only internally (e.g. "jspsych.js" - lines 2273 and 2411), but not exposed to the "jsPsych.init" method when creating an experiment. Tested with the latest release (6.3.1) with the "jspsych-html-keyboard-response" plugin and I can verify that by following the old documentation it doesn't work (for obvious reasons), but following the one I propose here it does work, as initially intended by the developers. Thanks!
2021-05-12 11:57:00 +02:00
Felix Molter
579e112d5b
Fixed plugin documentation title
Fixes the title of the documentation page for the `jspsych-webgazer-validate` plugin.
2021-04-30 08:53:09 +02:00
Josh de Leeuw
ab7ea845df add timing tests to test folder 2021-04-21 10:24:08 -04:00