Commit Graph

313 Commits

Author SHA1 Message Date
github-actions[bot]
16fac08078 chore(release): version packages 2022-05-23 18:13:04 +00:00
bjoluc
dc00566142 Include regenerator-runtime in the jspsych Babel build 2022-05-23 19:46:07 +02:00
Josh de Leeuw
4f49a58c09 remove console.log from test 2022-05-19 13:44:06 -04:00
github-actions[bot]
f1fa90eb2c chore(release): version packages 2022-05-19 13:10:19 +00:00
Vijay Marupudi
c84492c87e Use a more efficient method to access the most recent trial 2022-05-15 10:45:01 -05:00
github-actions[bot]
b38a8b94f0 chore(release): version packages 2022-03-13 15:31:28 +00:00
bjoluc
f26d2762d2 Use Math.random() to generate the default seed 2022-03-13 16:14:26 +01:00
bjoluc
bad26ebb08 Use alea PRNG for setSeed() 2022-03-13 15:14:25 +01:00
github-actions[bot]
90c844f890 chore(release): version packages 2022-03-12 23:29:17 +00:00
Josh de Leeuw
c10f21e442 fix for #2497 2022-03-12 18:13:47 -05:00
bjoluc
62b131efae Merge branch 'main' into patch-inline-fonts 2022-03-12 11:26:41 +01:00
Josh de Leeuw
6c216e0d34 fix seed type in test file 2022-03-11 15:19:20 -05:00
bjoluc
05091997db Fix circular dev dependency 🧐 🤯 2022-03-11 20:20:22 +01:00
bjoluc
887c247af2 Merge branch 'main' into feature-seed-rng 2022-03-11 19:34:31 +01:00
Josh de Leeuw
2cea5640f7 use string as seed 2022-03-11 12:31:47 -05:00
Josh de Leeuw
f2f9a00ae0 Merge branch 'main' into feature-seed-rng 2022-03-11 12:26:53 -05:00
Josh de Leeuw
b39b2f8671
Merge pull request #2407 from jspsych/feature-filterColumns
Add `filterColumns`, the opposite of `ignore()`.
2022-03-11 12:22:17 -05:00
Josh de Leeuw
594a7708f9
Update packages/jspsych/tests/data/datacollection.test.ts
Co-authored-by: bjoluc <mail@bjoluc.de>
2022-03-11 12:10:02 -05:00
Josh de Leeuw
4eb61c3e19
Update packages/jspsych/tests/data/datacollection.test.ts
Co-authored-by: bjoluc <mail@bjoluc.de>
2022-03-11 12:09:51 -05:00
Josh de Leeuw
9180ab9671
Update packages/jspsych/src/modules/data/DataCollection.ts
Co-authored-by: bjoluc <mail@bjoluc.de>
2022-03-11 12:09:26 -05:00
bjoluc
60f4d86835 Switch to Sass for jsPsych styles and inline fonts 2022-02-08 16:45:23 +01:00
bjoluc
9ab889f38e Integrate timeline draft with JsPsych class 2022-01-27 23:33:33 +01:00
bjoluc
76a02685d8 Implement basic result data handling 2022-01-13 21:54:09 +01:00
bjoluc
a876d215c0 Implement basic parameter handling 2022-01-13 14:39:21 +01:00
bjoluc
e0b94c3d23 Initial timeline and trial drafts, missing parameter and result handling 2022-01-10 14:01:00 +01:00
Josh de Leeuw
ab1f3214cd add test case for filterColumns 2021-12-17 12:04:04 -05:00
Josh de Leeuw
1cdbcf145b add return value 2021-12-17 12:02:14 -05:00
Josh de Leeuw
aa4acc4152 remove #s 2021-12-17 11:59:11 -05:00
Josh de Leeuw
d56d246a22 add filterColumns method 2021-12-17 11:58:58 -05:00
bjoluc
6f2613cc5c Setup turborepo 2021-12-11 23:28:07 +01:00
bjoluc
eed3e04833 add seedrandom types as a dev dependency 2021-12-11 17:59:49 +01:00
github-actions[bot]
1eef7219e1 chore(release): version packages 2021-12-08 14:24:49 +00:00
Josh de Leeuw
d9b92da1ac fix case where simulation_options is a function that evals to a string 2021-12-07 14:40:22 -05:00
Josh de Leeuw
83b1ba291f add setSeed to randomization 2021-12-07 11:03:48 -05:00
Josh de Leeuw
512ea0115e add seedable as dependency 2021-12-07 10:35:37 -05:00
Josh de Leeuw
e030ece054 remove # 2021-12-07 10:35:15 -05:00
github-actions[bot]
60e6fdf4ca chore(release): version packages 2021-12-06 19:32:29 +00:00
Josh de Leeuw
03375f66a3 fix bug where default simulation mode of data-only didn't work 2021-12-06 13:40:24 -05:00
github-actions[bot]
8f2eee87d0 chore(release): version packages 2021-11-29 20:50:45 +00:00
Josh de Leeuw
308a791a8a add timing test for audio input 2021-11-27 16:30:01 -05:00
bjoluc
7dbc303f90 add MediaRecorder types, polyfill ResizeObserver 2021-11-24 16:51:57 +01:00
Josh de Leeuw
aa0d28f990 make default null 2021-11-23 15:24:17 -05:00
Josh de Leeuw
fdd2ebb0b6 Merge branch 'main' into plugin-audio-input-plugins 2021-11-23 15:13:27 -05:00
Josh de Leeuw
522aa2cdbf
Adding a simulation mode (#2287)
Implements simulation mode in the core library, supporting API features, and plugin support in most plugins.
2021-11-23 15:12:30 -05:00
Josh de Leeuw
3a3d32971c start work on audio-input plugins 2021-11-19 17:00:10 -05:00
Josh de Leeuw
2922bc5dad
Merge pull request #2209 from jspsych/plugin-exclusions
New Plugin: Browser Check
2021-11-05 18:28:14 -04:00
Josh de Leeuw
c7c755efe7 add deprecation warning 2021-10-19 21:57:04 -04:00
bjoluc
1216ace2a3 Implement migration errors
Closes  #2217
2021-10-19 21:57:34 +02:00
Josh de Leeuw
ea3feaa47e allow endExperiment to save data to the final trial 2021-10-18 22:09:57 -04:00
github-actions[bot]
6840b932ad chore(release): version packages 2021-10-01 22:45:10 +00:00
bjoluc
2c392116ff Update homepage field in package.json files 2021-10-01 20:15:43 +02:00
bjoluc
8b279d1dbf Add directory to repository field in package.json files 2021-10-01 19:32:43 +02:00
Becky Gilbert
9d8cff0121 replace references to jsPsych.init with initJsPsych in console warnings/errors and comments 2021-09-30 23:11:07 -07:00
bjoluc
37b85f953c
Setup changesets (#2066)
* Setup changesets and the changesets GH action
* Lower package versions so changesets can bump them
* Add changesets for all changes on the `modularization` branch

Co-authored-by: Josh de Leeuw <josh.deleeuw@gmail.com>
Co-authored-by: Becky Gilbert <beckyannegilbert@gmail.com>
2021-09-30 21:39:25 +02:00
bjoluc
ff2827d8c9 Move test utility functions into @jspsych/test-utils 2021-09-28 20:04:19 +02:00
bjoluc
60ae24a932 Enable usage of test utils in external packages 2021-09-28 10:15:36 +02:00
bjoluc
338c1b62b6 Merge branch 'modularization' into modularization-es6-stuff 2021-09-15 11:53:19 +02:00
bjoluc
9d8e39aaae Modernize factorial function 2021-09-15 11:23:26 +02:00
bjoluc
7073cfb245 Add explicit baseUrl option to tsconfigs 2021-09-14 21:31:44 +02:00
bjoluc
6a8596fb76 Merge branch 'main' into modularization 2021-09-14 20:36:05 +02:00
bjoluc
63acb56dac Re-enable tests that depend on plugins converted in #2078 2021-09-14 18:31:48 +02:00
Josh de Leeuw
12d675320f
Allow on_finish to return a Promise and delay the endExperiment message. (#2142)
* implement Promise handling for on_finish() experiment event. #2050 #1850

* add documentation
2021-09-10 13:40:56 -04:00
Josh de Leeuw
f37f64ac61
Rounds all duration measurements to the nearest INT (#2129)
Rounds all duration measurements to the nearest INT
2021-09-10 09:55:35 -04:00
Josh de Leeuw
2802430999
Generalize the on_load event so that plugins with async loads can trigger event (#2130)
Create optional `on_load: () => void` callback from `trial()` method and implement early-stage promise handling on timeline.
2021-09-09 14:40:06 -04:00
Becky Gilbert
db754538b7
Convert plugins to classes and update examples (#2078)
* modularize plugins: edit index.ts and example files (WIP)

* continue modularizing plugins: edit index.ts and example files (WIP)

* continue modularizing plugins: edit index.ts and example files (WIP)

* continue modularizing plugins and example files, make info static in plugin classes

* add preload flag to plugin info, fix a few parameterType values

* change preload flags in plugin info from audio/image/video strings to boolean

* convert more plugins and example files

* convert more plugins/examples, sync with webgazer branch plugins/examples (not working on this branch)

* remove preload flag from info, change to ParameterType, change to "ALL_KEYS"/"NO_KEYS", change KEY type to KEYS for array params

* remove descriptions from plugin info, fix some ALL_KEYS/NO_KEYS errors

* remove descriptions and add pretty names to plugin info

* remove/edit comments re ALL_KEYS/NO_KEYS and TS errors

* fix some preload plugin errors and convert example file (plugin still not working due to getAutoPreloadList)

* convert RDK plugin and example file

* convert preload plugin and example, add JsPsych getTimelineDescription method for auto-preloading (still not working for audio due to getAudioBuffer

* fix jsPsych getTimelineDescription method so that it does recursive search

* add image and video preloading to plugin examples

* Merge branch 'modularization' into modularization-plugins

* add tests for reconstruction

* fix timeline array getter method: add private timelineDescription var, set to timeline array in run(), rename getTimelineDescription to getTimeline

* changes in response to PR review: fix JsDoc comments, fix array: true in param info, change HTML string param types, add JsDoc author/file/see docs for all plugin classes, switch to @ts-expect-error. Thanks @bjoluc!

* fix JsDoc comments for plugin classes and preload trials parameter

* change preload type to boolean in ParameterInfo interface, and add `preload: false` to virtual-chinrest item_path image parameter

* All my tests except for preload plugin (will do that tomorrow)

* minor fixes to reconstruction tests

* Update preload plugin tests

* Finish test conversion

* switch to arrow functions to fix this keyword errors in plugins, add audio preloading into plugin example files, fix typos

* convert non-plugin example files (WIP, not tested)

* Fix allow_held_keys -> allow_held_key parameter in virtual-chinrest plugin

* Fix `keyboardListener` type in serial-reaction-time plugin

* type fixes for RDK, simplifying `correctOrNot()` function

* fixed ["ALL_KEYS"] => "ALL_KEYS" for iat plugins and tests

* Build jspsych packages before everything else

Dependent builds were previously failing due to missing type definitions

* Remove console.log from html-keyboard-response tests

I think I accidentially committed it.

* fix the delayed start to animation bug (#1885)

* round all RTs to nearest int (#2108)

* fixes and tests #1900 - IAT parameter problems

* finish converting/testing example files, add init settings, add audio preloading, fix errors

* fix progress-bar timeline to demo an example where auto-updating the progress bar works well

* Revert "round all RTs to nearest int (#2108)"

This reverts commit f53145d2e3.

* change how delayed timeline variables are implemented

* use static for generate_stimulus method so that it can be called on the vsl-grid-scene class

* fix external-html plugin and example (switch to arrow function for proper this context, fix incorrect parameter name)

* remove outdated TO DO comments

Co-authored-by: bjoluc <mail@bjoluc.de>
Co-authored-by: Josh de Leeuw <josh.deleeuw@gmail.com>
2021-09-08 09:44:53 -04:00
Josh de Leeuw
ddc3436b2f add test case for #2105 2021-09-01 15:26:40 -04:00
Josh de Leeuw
f4d04e5056
Merge pull request #2098 from bjoluc/preloading
Rework preloading in MediaAPI
2021-09-01 15:04:32 -04:00
Josh de Leeuw
a66d29c31f
Merge pull request #2087 from bjoluc/refactor-keyboard-listener-api
Refactor KeyboardListenerAPI
2021-09-01 14:59:26 -04:00
Josh de Leeuw
898a38d3a7 TS-ify turk module, incorporate #1563 fix 2021-09-01 13:19:12 -04:00
bjoluc
ab7b3545cf Add @jspsych/config dev dependency to packages 2021-08-25 22:08:45 +02:00
bjoluc
7499817415 Add exports field to package.json 2021-08-25 21:58:23 +02:00
bjoluc
6006fec96a Prepare @jspsych/config for external use 2021-08-25 21:57:28 +02:00
Josh de Leeuw
d636e3ac45 update JSON2CSV implementation, other utils 2021-08-25 15:34:03 -04:00
Josh de Leeuw
c374991d17 update preloading methods to use es6 features 2021-08-25 11:20:53 -04:00
Josh de Leeuw
a77052deb2 replace var where needed 2021-08-25 11:06:11 -04:00
Josh de Leeuw
266f756155 replace var where needed 2021-08-25 11:05:56 -04:00
Josh de Leeuw
b5f06d4144 update tests for es6 2021-08-25 10:56:40 -04:00
Josh de Leeuw
a54ed29e6e update unique() to use es6 Set 2021-08-24 13:45:41 -04:00
Josh de Leeuw
2224784219 replace utility method flatten() with es6 .flat() 2021-08-24 13:44:58 -04:00
Josh de Leeuw
8e58f6e160 cleanup of issues IDed in review 2021-08-23 15:01:21 -04:00
Josh de Leeuw
3500e2b001 fixing const/let, replacing == with === 2021-08-23 14:36:56 -04:00
Josh de Leeuw
5d060f6b96 rename getter methods, update docs 2021-08-23 13:11:32 -04:00
Josh de Leeuw
a3769deb81 for loop update 2021-08-23 12:52:49 -04:00
Josh de Leeuw
254dd6612c update var 2021-08-23 12:51:28 -04:00
Josh de Leeuw
9b2fc7e68b reimplement factorial() method, add tests, replace var with let/const 2021-08-23 11:41:50 -04:00
Josh de Leeuw
019ab49fea replace var with let/const 2021-08-23 10:00:28 -04:00
Josh de Leeuw
4b5a4398c7 update for loops, var keyword 2021-08-23 09:53:08 -04:00
Josh de Leeuw
861f83e185 replace var with let/const; replace some for loops 2021-08-23 09:34:09 -04:00
Josh de Leeuw
c20b2dad49 replace var with let or const 2021-08-23 09:03:30 -04:00
bjoluc
0a8773204e Remove useWebaudio default value in MediaAPI constructor 2021-08-23 11:19:52 +02:00
bjoluc
fee9e19614 Merge branch 'modularization' into preloading 2021-08-23 11:01:24 +02:00
bjoluc
a06b07ddc9 Get rid of reset and createKeyboardEventListeners, instantiate API objects directly in pluginapi tests 2021-08-22 21:59:12 +02:00
bjoluc
39e84a02e2 Remove keycode functionality 2021-08-22 16:25:24 +02:00
bjoluc
cbce6d8919 Replace KeyboardListener objects directly with callback functions 2021-08-22 15:45:55 +02:00
bjoluc
2b82cab264 Remove outdated import in test-extension.ts 2021-08-22 00:33:00 +02: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
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
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
4fcb2f7e56 Refactor KeyboardListenerAPI 2021-08-17 19:13:30 +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
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
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
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
91e7b1e3ff Migrate to TypeScript 2021-07-06 17:55:42 +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