flesh out extension description and fix minor details

This commit is contained in:
jade 2024-11-07 17:49:18 -05:00
parent 96c7092042
commit 8d40c445b4
2 changed files with 9 additions and 13 deletions

View File

@ -66,7 +66,7 @@ let trial = {
extensions: [ extensions: [
{type: myAwesomeExtension, params: {demo: 'value'}} {type: myAwesomeExtension, params: {demo: 'value'}}
] ]
}); };
//... extension code ...// //... extension code ...//
class MyAwesomeExtension { class MyAwesomeExtension {
@ -91,7 +91,7 @@ let trial = {
extensions: [ extensions: [
{type: myAwesomeExtension, params: {demo: 'value'}} {type: myAwesomeExtension, params: {demo: 'value'}}
] ]
}); };
//... extension code ...// //... extension code ...//
class MyAwesomeExtension { class MyAwesomeExtension {
@ -122,7 +122,7 @@ let trial = {
on_finish: (data) => { on_finish: (data) => {
console.log(data.awesome); // will output 'value'. console.log(data.awesome); // will output 'value'.
} }
}); };
//... extension code ...// //... extension code ...//
class MyAwesomeExtension { class MyAwesomeExtension {
@ -168,9 +168,11 @@ The `version` field describes the version of the extension used and then durin t
The `data` field is an object containing all of the `data` generated for the plugin. Each 'data' object has a `type` and `default` property. Additionally, this should be only used for data you choose to generate. Any jsdoc (comments included in the /** */ tags) you include will be scraped as metadata if you are choosing to generate metadata. This scraped metadata will also be used to create the JsPsych documentation. The `data` field is an object containing all of the `data` generated for the plugin. Each 'data' object has a `type` and `default` property. Additionally, this should be only used for data you choose to generate. Any jsdoc (comments included in the /** */ tags) you include will be scraped as metadata if you are choosing to generate metadata. This scraped metadata will also be used to create the JsPsych documentation.
For more information on the various types of parameters one can include in their data field, see [here](./plugin-development.md#parameter-types).
### Optional methods ### Optional methods
The extension can also include any additional methods that are necessary for interacting with it. See the [webgazer extension](../extensions/webgazer.md) for an example. The extension can also include any additional methods that are necessary for interacting with it. See the [WebGazer extension](../extensions/webgazer.md) for an example.
## Advice for writing extensions ## Advice for writing extensions

View File

@ -1,6 +1,6 @@
# Extensions # Extensions
Extensions are jsPsych modules that can interface with any plugin to extend the functionality of the plugin. A canonical example of an extension is eye tracking. An eye tracking extension allows a plugin to gather gaze data and add it to the plugin's data object. In jsPsych, extensions allow one to extend the functionality of various plugins, giving individual plugins the ability to collect more data, display additional stimuli, and more. A canonical example of an extension is [eye tracking](../extensions/webgazer.md), which allow plugins to gather gaze data and add it to the their respective data objects. For a full list of extensions directly included in the jsPsych release, see [here](../extensions/list-of-extensions.md).
## Using an Extension ## Using an Extension
@ -31,12 +31,6 @@ var trial = {
} }
``` ```
## List of Extensions
Extension | Description
------ | -----------
[jspsych‑ext‑webgazer.js](../extensions/webgazer.md) | Enables eye tracking using the [WebGazer](https://webgazer.cs.brown.edu/) library.
## Writing an Extension ## Writing an Extension
See our [developer's guide for extensions](../developers/extension-development.md) for information about how to create a new extension. See our [developer's guide for extensions](../developers/extension-development.md) for information about how to create a new extension.