Commit Graph

12 Commits

Author SHA1 Message Date
bjoluc
2092d12a60 Rename jsPsych.end... functions to jsPsych.abort... and implement abortCurrentTimeline 2022-11-08 22:27:32 +01:00
bjoluc
bdaff4aefc Adapt implementation to timelines.test.ts 2022-10-11 21:49:10 +02:00
bjoluc
d7f29da8f5 Adapt Timeline tests and implementation according to timeline-variables.test.ts 2022-10-10 20:00:24 +02:00
bjoluc
ff2827d8c9 Move test utility functions into @jspsych/test-utils 2021-09-28 20:04:19 +02:00
bjoluc
338c1b62b6 Merge branch 'modularization' into modularization-es6-stuff 2021-09-15 11:53:19 +02:00
Josh de Leeuw
266f756155 replace var where needed 2021-08-25 11:05:56 -04:00
bjoluc
c30b6ad19a Rework preloading in MediaAPI
This drops support for the `registerPreload()` function and instead
infers preloading information on the fly in `getAutoPreloadList()`.
2021-08-22 00:11:17 +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
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
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
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
91e7b1e3ff Migrate to TypeScript 2021-07-06 17:55:42 +02:00