fix wording and some links

This commit is contained in:
jade 2024-11-20 14:12:44 -05:00
parent 2f859b8887
commit f4ba84a3a7
4 changed files with 7 additions and 10 deletions

View File

@ -168,7 +168,7 @@ 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). For more information on the various types of parameters one can include in their data field, see our [documentation on `ParameterType`s](./plugin-development.md#parameter-types).
### Optional methods ### Optional methods

View File

@ -61,9 +61,9 @@ const info = {
} }
``` ```
??? info "Custom Build Environments" ??? info "Automatic versioning with custom build environments"
If you are using a custom build environment that imports its own `tsconfig.json` file that does not extend jsPsych's, but you want to use this syntax, you must add `"resolveJsonModule": true` to the config's `compilerOptions` object. If you are using a custom build environment that imports its own `tsconfig.json` file that does not extend jsPsych's, and you want to use this automatic versioning syntax, you must add `"resolveJsonModule": true` to the config's `compilerOptions` object.
If you are not using a build environment that supports `import` and `package.json` (such as writing a plain JS file), you can manually enter the `version` as a string. If you are not using a build environment that supports `import` and `package.json` (such as writing a plain JS file), you can manually enter the `version` as a string.
@ -169,7 +169,7 @@ MyAwesomePlugin.info = info;
#### Parameter Types #### Parameter Types
jsPsych currently has support for the following parameters: jsPsych currently has support for the following parameter types:
| Type Name | Description | Example | | Type Name | Description | Example |
| --------- | ----------- | ------- | | --------- | ----------- | ------- |

View File

@ -298,7 +298,7 @@ Returns nothing.
#### Description #### Description
Method that belongs to the AudioPlayer class. Stops the audio loaded into the audio buffer of the AudioPlayer instance for a particular file. If the audio is an HTML5 audio object it pauses it. If the audio is a Webaudio API object it stops it. This will regenerate the audio player, allowing you to call the `play()` method upon it again. Method that belongs to the AudioPlayer class. Stops the audio loaded into the audio buffer of the AudioPlayer instance for a particular file. If the audio is an HTML5 audio object it pauses it. If the audio is a WebAudio API object it stops it. This will regenerate the audio player, allowing you to call the `play()` method upon it again.
#### Example #### Example

View File

@ -86,9 +86,6 @@ const trial = {
The `button_html` parameter can also support different HTML for each button. The `button_html` parameter can also support different HTML for each button.
See the [plugin documentation](https://www.jspsych.org/latest/plugins/html-button-response/index.html) for more details. See the [plugin documentation](https://www.jspsych.org/latest/plugins/html-button-response/index.html) for more details.
For plugin developers: if you are writing a plugin and updating parameters to use functions,
make sure to mock these functions in Jest to ensure tests can still run.
## Plugin parameter handling ## Plugin parameter handling
In version 7.x, a plugin could omit parameters from the `info` object and jsPsych would still evaluate these parameters appropriately in most cases. In version 7.x, a plugin could omit parameters from the `info` object and jsPsych would still evaluate these parameters appropriately in most cases.
@ -113,7 +110,7 @@ In version 9.x, we plan to make this a requirement.
In version 7.x, jsPsych's `pluginAPI` class exposed WebAudio and HTML5 audio APIs through `getAudioBuffer()`. However, this required different implementations done by the developer to account for each API. In version 7.x, jsPsych's `pluginAPI` class exposed WebAudio and HTML5 audio APIs through `getAudioBuffer()`. However, this required different implementations done by the developer to account for each API.
In version 8.x, we've removed this in favor of `getAudioPlayer()`, which handles both API choices under the hood. In version 8.x, we've removed this in favor of `getAudioPlayer()`, which handles both API choices under the hood.
This change only effects plugin developers. If you want to update to use the new `getAudioPlayer()`, it is recommend that you call this new method using the `await` syntax, which requires an asynchronous `trial` function: This change only affects plugin developers. If you want to update to use the new `getAudioPlayer()`, it is recommend that you call this new method using the `await` syntax, which requires an asynchronous `trial` function:
```js ```js
const audio = await jsPsych.pluginAPI.getAudioPlayer('my-sound.mp3'); const audio = await jsPsych.pluginAPI.getAudioPlayer('my-sound.mp3');
``` ```
@ -148,7 +145,7 @@ Along with this, the `start()` and `pause()` functions were removed from the `Au
You can still call `stop()` upon an audio ending in order to regenerate the `AudioPlayer`, and be able You can still call `stop()` upon an audio ending in order to regenerate the `AudioPlayer`, and be able
to call `play()` on it again. to call `play()` on it again.
For a general guide on implementation, the `audio-button-response` plugin uses the `await` syntax For a general guide on implementation, the [`audio-button-response`](https://github.com/jspsych/jsPsych/blob/main/packages/plugin-audio-button-response/src/index.ts) plugin uses the `await` syntax
to handle playing audio. to handle playing audio.
## Changes to `finishTrial()` ## Changes to `finishTrial()`