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>
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.
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>
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.
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.
* 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
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!