Addressing changes to version and data being part of the required documentation for extensions and plugins

This commit is contained in:
vzhang03 2024-07-09 16:23:56 -04:00
parent 59cc6138ac
commit b8bffb5980
2 changed files with 39 additions and 6 deletions

View File

@ -9,7 +9,7 @@ As of version 7.0, extensions are [JavaScript Classes](https://developer.mozilla
* [An `on_start()` function](#on_start) to handle the on_start event of the extension.
* [An `on_load()` function](#on_load) to handle the on_load event of the extension.
* [An `on_finish()` function](#on_finish) to handle the on_finish event of the extension and store data that the extension collects.
* [A static `info`](#static-info) property containing a unique name for the extension.
* [A static `info`](#static-info) property containing a unique name, version parameter and data property for the extension.
### Templates
@ -144,18 +144,31 @@ class MyAwesomeExtension {
### static .info
The `info` property for the class must contain an object with a `name` property that has a unique name for the extension.
The `info` property for the class must contain an object with a `name` property that has a unique name for the extension, a `version` property that has the version string, and a `data` parameter that includes information about the `data` generated by the extension.
```js
import { version } from '../package.json';
class MyAwesomeExtension {
}
MyAwesomeExtension.info = {
name: 'awesome'
name: 'awesome',
version: version, // can also be hardcoded as `version: "1.0.1"`
data: {
/** This will be scraped as metadata describing tracking_data. */
tracking_data: {
type: ParameterType.STRING,
}
}
}
```
The `version` field describes the version of the extension used and then durin the experiment will be part of the generated data. This is used generate metadata and help maintain the Psych-DS standard. It should imported from the package.json file by including an import statement in the top of the index.ts file. This allows the `version` field be automatically updated with each changeset. If you are not using a build environment and instead writing a plain JS file, you can manually enter the `version` as a string as done in the comment.
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 javadoc you include will be scraped as metadata if you are choosing to generate metadata.
### 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.

View File

@ -49,11 +49,31 @@ const info = {
}
```
The `version` field should imported from the package.json file by including an import statement in the top of the index.ts file. This lets the `version` field be automatically updated with each changeset.
The `version` field describes the version of the plugin used and then durin the experiment will be part of the generated data. This is used generate metadata and help maintain the Psych-DS standard. It should imported from the package.json file by including an import statement in the top of the index.ts file. This allows the `version` field be automatically updated with each changeset.
```javascript
import { version } from '../package.json';
const info = {
...
version: version;
...
}
```
If you are not using a build environment and instead writing a plain JS file, you can manually enter the `version` as a string.
```javascript
const info = {
...
version: "1.0.0";
...
}
```
The `parameters` property is an object containing all of the parameters for the plugin. Each parameter has a `type` and `default` property.
The `data` field is similar to the `parameters` property, except it does not include a `default` property. Additionally, the `data` describes data that is only generated, and should be only used for data you generate not the default data. Any javadoc you include will be scraped as metadata if you are choosing to generate metadata.
The `data` field is similar to the `parameters` property, except it does not include a `default` property and instead describes the data generated. Additionally, this should be only used for data you choose to generate and not the default data. Any javadoc you include will be scraped as metadata.
```js
const info = {
@ -69,7 +89,7 @@ const info = {
}
},
data: {
/** This will become metadata describing response. */
/** This will become metadata describing "response". */
response: {
type: ParameterType.STRING,
},