mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 19:20:55 +00:00
Merge pull request #3166 from jspsych/v8-remove-deprecated-features
Remove deprecated features for version 8
This commit is contained in:
commit
ec7e207c35
7
.changeset/flat-tables-repair.md
Normal file
7
.changeset/flat-tables-repair.md
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
"jspsych": major
|
||||||
|
---
|
||||||
|
|
||||||
|
Removed the `exclusions` option from `initJsPsych()`. The recommended replacement for this functionality is the browser-check plugin.
|
||||||
|
|
||||||
|
Removed the `hardwareAPI` module from the pluginAPI. This was no longer being updated and the features were out of date.
|
@ -8,5 +8,5 @@ As of v7.1 of jsPsych, the recommended way to do this is using the [browser-chec
|
|||||||
This plugin can record many features of the participant's browser and exclude participants who do not meet a defined set of inclusion criteria.
|
This plugin can record many features of the participant's browser and exclude participants who do not meet a defined set of inclusion criteria.
|
||||||
Please see the [browser-check plugin documentation](../plugins/browser-check.md) for more details.
|
Please see the [browser-check plugin documentation](../plugins/browser-check.md) for more details.
|
||||||
|
|
||||||
The prior approach of using the `exclusions` parameter in `initJsPsych()` is deprecated and will be removed in `v8.0`.
|
The prior approach of using the `exclusions` parameter in `initJsPsych()` is deprecated. It was removed as of `v8.0`.
|
||||||
You can find the documentation for it in the [7.0 docs](https://www.jspsych.org/7.0/overview/exclude-browser).
|
You can find the documentation for it in the [7.0 docs](https://www.jspsych.org/7.0/overview/exclude-browser).
|
||||||
|
@ -24,7 +24,6 @@ The settings object can contain several parameters. None of the parameters are r
|
|||||||
| on_data_update | function | Function to execute every time data is stored using the `jsPsych.data.write` method. All plugins use this method to save data (via a call to `jsPsych.finishTrial`, so this function runs every time a plugin stores new data. |
|
| on_data_update | function | Function to execute every time data is stored using the `jsPsych.data.write` method. All plugins use this method to save data (via a call to `jsPsych.finishTrial`, so this function runs every time a plugin stores new data. |
|
||||||
| on_interaction_data_update | function | Function to execute every time a new interaction event occurs. Interaction events include clicking on a different window (blur), returning to the experiment window (focus), entering full screen mode (fullscreenenter), and exiting full screen mode (fullscreenexit). |
|
| on_interaction_data_update | function | Function to execute every time a new interaction event occurs. Interaction events include clicking on a different window (blur), returning to the experiment window (focus), entering full screen mode (fullscreenenter), and exiting full screen mode (fullscreenexit). |
|
||||||
| on_close | function | Function to execute when the user leaves the page. Can be used, for example, to save data before the page is closed. |
|
| on_close | function | Function to execute when the user leaves the page. Can be used, for example, to save data before the page is closed. |
|
||||||
| exclusions | object | Specifies restrictions on the browser the participant can use to complete the experiment. See list of options below. *This feature is deprecated as of v7.1 and will be removed in v8.0. The [browser-check plugin](../plugins/browser-check.md) is an improved way to handle exclusions.* |
|
|
||||||
| show_progress_bar | boolean | If `true`, then [a progress bar](../overview/progress-bar.md) is shown at the top of the page. Default is `false`. |
|
| show_progress_bar | boolean | If `true`, then [a progress bar](../overview/progress-bar.md) is shown at the top of the page. Default is `false`. |
|
||||||
| message_progress_bar | string or function | Message to display next to the progress bar or a function that returns that message. The default is 'Completion Progress'. If `message_progress_bar` is a function, it receives one single argument which is the current progress, ranging from 0 to 1; the function gets called on every progress bar update automatically. |
|
| message_progress_bar | string or function | Message to display next to the progress bar or a function that returns that message. The default is 'Completion Progress'. If `message_progress_bar` is a function, it receives one single argument which is the current progress, ranging from 0 to 1; the function gets called on every progress bar update automatically. |
|
||||||
| auto_update_progress_bar | boolean | If true, then the progress bar at the top of the page will automatically update as every top-level timeline or trial is completed. |
|
| auto_update_progress_bar | boolean | If true, then the progress bar at the top of the page will automatically update as every top-level timeline or trial is completed. |
|
||||||
@ -36,14 +35,6 @@ The settings object can contain several parameters. None of the parameters are r
|
|||||||
| case_sensitive_responses | boolean | If `true`, then jsPsych will make a distinction between uppercase and lowercase keys when evaluating keyboard responses, e.g. "A" (uppercase) will not be recognized as a valid response if the trial only accepts "a" (lowercase). If false, then jsPsych will not make a distinction between uppercase and lowercase keyboard responses, e.g. both "a" and "A" responses will be valid when the trial's key choice parameter is "a". Setting this parameter to false is useful if you want key responses to be treated the same way when CapsLock is turned on or the Shift key is held down. The default value is `false`. |
|
| case_sensitive_responses | boolean | If `true`, then jsPsych will make a distinction between uppercase and lowercase keys when evaluating keyboard responses, e.g. "A" (uppercase) will not be recognized as a valid response if the trial only accepts "a" (lowercase). If false, then jsPsych will not make a distinction between uppercase and lowercase keyboard responses, e.g. both "a" and "A" responses will be valid when the trial's key choice parameter is "a". Setting this parameter to false is useful if you want key responses to be treated the same way when CapsLock is turned on or the Shift key is held down. The default value is `false`. |
|
||||||
extensions | array | Array containing information about one or more jsPsych extensions that are used during the experiment. Each extension should be specified as an object with `type` (required), which is the name of the extension, and `params` (optional), which is an object containing any parameter-value pairs to be passed to the extension's `initialize` function. Default value is an empty array. |
|
extensions | array | Array containing information about one or more jsPsych extensions that are used during the experiment. Each extension should be specified as an object with `type` (required), which is the name of the extension, and `params` (optional), which is an object containing any parameter-value pairs to be passed to the extension's `initialize` function. Default value is an empty array. |
|
||||||
|
|
||||||
Possible values for the exclusions parameter above.
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| ---------- | ------- | ---------------------------------------- |
|
|
||||||
| min_width | numeric | The minimum width of the browser window. If the width is below this value, a message will be displayed to the participant asking them to maximize their browser window. The experiment will sit on this page until the browser window is large enough. |
|
|
||||||
| min_height | numeric | Same as above, but with height. |
|
|
||||||
| audio | boolean | Set to true to require support for the WebAudio API (used by plugins that play audio files). |
|
|
||||||
|
|
||||||
### Return value
|
### Return value
|
||||||
|
|
||||||
Returns a jsPsych instance, which all jsPsych methods on this page are called on. Therefore it is not possible to call any of the jsPsych methods listed on this page until this `initJsPsych` function is called and a jsPsych instance is created.
|
Returns a jsPsych instance, which all jsPsych methods on this page are called on. Therefore it is not possible to call any of the jsPsych methods listed on this page until this `initJsPsych` function is called and a jsPsych instance is created.
|
||||||
|
@ -70,7 +70,6 @@ export class JsPsych {
|
|||||||
on_interaction_data_update: () => {},
|
on_interaction_data_update: () => {},
|
||||||
on_close: () => {},
|
on_close: () => {},
|
||||||
use_webaudio: true,
|
use_webaudio: true,
|
||||||
exclusions: {},
|
|
||||||
show_progress_bar: false,
|
show_progress_bar: false,
|
||||||
message_progress_bar: "Completion Progress",
|
message_progress_bar: "Completion Progress",
|
||||||
auto_update_progress_bar: true,
|
auto_update_progress_bar: true,
|
||||||
|
@ -1,32 +0,0 @@
|
|||||||
export class HardwareAPI {
|
|
||||||
/**
|
|
||||||
* Indicates whether this instance of jspsych has opened a hardware connection through our browser
|
|
||||||
* extension
|
|
||||||
**/
|
|
||||||
hardwareConnected = false;
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
//it might be useful to open up a line of communication from the extension back to this page
|
|
||||||
//script, again, this will have to pass through DOM events. For now speed is of no concern so I
|
|
||||||
//will use jQuery
|
|
||||||
document.addEventListener("jspsych-activate", (evt) => {
|
|
||||||
this.hardwareConnected = true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allows communication with user hardware through our custom Google Chrome extension + native C++ program
|
|
||||||
* @param mess The message to be passed to our extension, see its documentation for the expected members of this object.
|
|
||||||
* @author Daniel Rivas
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
hardware(mess) {
|
|
||||||
//since Chrome extension content-scripts do not share the javascript environment with the page
|
|
||||||
//script that loaded jspsych, we will need to use hacky methods like communicating through DOM
|
|
||||||
//events.
|
|
||||||
const jspsychEvt = new CustomEvent("jspsych", { detail: mess });
|
|
||||||
document.dispatchEvent(jspsychEvt);
|
|
||||||
//And voila! it will be the job of the content script injected by the extension to listen for
|
|
||||||
//the event and do the appropriate actions.
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,7 +1,6 @@
|
|||||||
import autoBind from "auto-bind";
|
import autoBind from "auto-bind";
|
||||||
|
|
||||||
import { JsPsych } from "../../JsPsych";
|
import { JsPsych } from "../../JsPsych";
|
||||||
import { HardwareAPI } from "./HardwareAPI";
|
|
||||||
import { KeyboardListenerAPI } from "./KeyboardListenerAPI";
|
import { KeyboardListenerAPI } from "./KeyboardListenerAPI";
|
||||||
import { MediaAPI } from "./MediaAPI";
|
import { MediaAPI } from "./MediaAPI";
|
||||||
import { SimulationAPI } from "./SimulationAPI";
|
import { SimulationAPI } from "./SimulationAPI";
|
||||||
@ -16,17 +15,14 @@ export function createJointPluginAPIObject(jsPsych: JsPsych) {
|
|||||||
);
|
);
|
||||||
const timeoutAPI = new TimeoutAPI();
|
const timeoutAPI = new TimeoutAPI();
|
||||||
const mediaAPI = new MediaAPI(settings.use_webaudio);
|
const mediaAPI = new MediaAPI(settings.use_webaudio);
|
||||||
const hardwareAPI = new HardwareAPI();
|
|
||||||
const simulationAPI = new SimulationAPI(
|
const simulationAPI = new SimulationAPI(
|
||||||
jsPsych.getDisplayContainerElement,
|
jsPsych.getDisplayContainerElement,
|
||||||
timeoutAPI.setTimeout.bind(timeoutAPI)
|
timeoutAPI.setTimeout.bind(timeoutAPI)
|
||||||
);
|
);
|
||||||
return Object.assign(
|
return Object.assign(
|
||||||
{},
|
{},
|
||||||
...[keyboardListenerAPI, timeoutAPI, mediaAPI, hardwareAPI, simulationAPI].map((object) =>
|
...[keyboardListenerAPI, timeoutAPI, mediaAPI, simulationAPI].map((object) => autoBind(object))
|
||||||
autoBind(object)
|
) as KeyboardListenerAPI & TimeoutAPI & MediaAPI & SimulationAPI;
|
||||||
)
|
|
||||||
) as KeyboardListenerAPI & TimeoutAPI & MediaAPI & HardwareAPI & SimulationAPI;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type PluginAPI = ReturnType<typeof createJointPluginAPIObject>;
|
export type PluginAPI = ReturnType<typeof createJointPluginAPIObject>;
|
||||||
|
Loading…
Reference in New Issue
Block a user