From 6470d4092c7646eb26e971443d6c3a3a2c94072b Mon Sep 17 00:00:00 2001 From: jade <101148768+jadeddelta@users.noreply.github.com> Date: Wed, 20 Nov 2024 01:01:56 -0500 Subject: [PATCH] delete functions removed in v8 --- docs/reference/jspsych-pluginAPI.md | 63 +---------------- docs/reference/jspsych.md | 105 +++------------------------- 2 files changed, 11 insertions(+), 157 deletions(-) diff --git a/docs/reference/jspsych-pluginAPI.md b/docs/reference/jspsych-pluginAPI.md index ffc7da3b58..f467cb6206 100644 --- a/docs/reference/jspsych-pluginAPI.md +++ b/docs/reference/jspsych-pluginAPI.md @@ -234,7 +234,7 @@ Returns a Promise that resolves to an instance of an AudioPlayer class that hold #### Description -Gets an AudioPlayer class instance which has methods that can be used to play or stop audio that can be played with the WebAudio API or an audio object that can be played as HTML5 Audio. +Gets an AudioPlayer class instance which has methods that can be used to play or stop audio that can be played with the WebAudio API or an audio object that can be played as HTML5 Audio. By default, jsPsych uses the WebAudio API to play audio in the browser, so if you want to use HTML5 Audio, be sure to put `use_webaudio: false` in the `initJsPsych` object. It is strongly recommended that you preload audio files before calling this method. This method will load the files if they are not preloaded, but this may result in delays during the experiment as audio is downloaded. @@ -384,63 +384,6 @@ See the `audio-keyboard-response` plugin for an example in a fuller context. ## Other Media -### getAudioBuffer - -```javascript -jsPsych.pluginAPI.getAudioBuffer(filepath) -``` - -#### Parameters - -Parameter | Type | Description -----------|------|------------ -filepath | string | The path to the audio file that was preloaded. - -#### Return value - -Returns a Promise that resolves when the audio file loads. Success handler's parameter will be the audio buffer. If the experiment is running using the WebAudio API it will be an AudioBuffer object. Otherwise, it will be an HTML5 Audio object. The failure handler's parameter is the error generated by `preloadAudio`. - -#### Description - -Gets an AudioBuffer that can be played with the WebAudio API or an Audio object that can be played with HTML5 Audio. - -It is strongly recommended that you preload audio files before calling this method. This method will load the files if they are not preloaded, but this may result in delays during the experiment as audio is downloaded. - -#### Examples - -##### HTML 5 Audio - -```javascript -jsPsych.pluginAPI.getAudioBuffer('my-sound.mp3') - .then(function(audio){ - audio.play(); - }) - .catch(function(err){ - console.error('Audio file failed to load') - }) -``` - -##### WebAudio API - -```javascript -var context = jsPsych.pluginAPI.audioContext(); - -jsPsych.pluginAPI.getAudioBuffer('my-sound.mp3') - .then(function(buffer){ - audio = context.createBufferSource(); - audio.buffer = buffer; - audio.connect(context.destination); - audio.start(context.currentTime); - }) - .catch(function(err){ - console.error('Audio file failed to load') - }) -``` - -See the `audio-keyboard-response` plugin for an example in a fuller context. - ---- - ### getAutoPreloadList ```javascript @@ -564,7 +507,7 @@ None. #### Description -Generates a `MediaRecorder` object from provided `MediaStream` and stores this for access via [getCameraRecorder()](#getcamerarecorder). +Generates a `MediaRecorder` object from provided `MediaStream` and stores this for access via [`getCameraRecorder()`](#getcamerarecorder). #### Example @@ -597,7 +540,7 @@ None. #### Description -Generates a `MediaRecorder` object from provided `MediaStream` and stores this for access via [getMicrophoneRecorder()](#getmicrophonerecorder). +Generates a `MediaRecorder` object from provided `MediaStream` and stores this for access via [`getMicrophoneRecorder()`](#getmicrophonerecorder). #### Example diff --git a/docs/reference/jspsych.md b/docs/reference/jspsych.md index da29234b76..a4d4260307 100644 --- a/docs/reference/jspsych.md +++ b/docs/reference/jspsych.md @@ -228,42 +228,6 @@ const memoryTestProcedure = { ``` ---- -## jsPsych.addNodeToEndOfTimeline - -```javascript -jsPsych.addNodeToEndOfTimeline(node_parameters) -``` - -### Parameters - -| Parameter | Type | Description | -| --------------- | -------- | ---------------------------------------- | -| node_parameters | object | An object defining a timeline. It must have, at a minimum, a `timeline` parameter with a valid timeline array as the value for that parameter. | - -### Return value - -None. - -### Description - -Adds the timeline to the end of the experiment. - -### Example - -```javascript -var trial = { - type: jsPsychHtmlKeyboardResponse, - stimulus: 'This is a new trial.' -} - -var new_timeline = { - timeline: [trial] -} - -jsPsych.addNodeToEndOfTimeline(new_timeline) -``` - --- ## jsPsych.evaluateTimelineVariable @@ -330,13 +294,14 @@ Returns nothing. ### Description -This method tells jsPsych that the current trial is over. It is used in all of the plugins to end the current trial. When the trial ends a few things happen: +This method tells jsPsych that the current trial is over. It is used in all of the plugins to end the current trial. When the trial ends, a few things happen: * The data is stored using `jsPsych.data.write()` -* The on_finish callback function is executed for the trial -* The on_trial_finish callback function is executed +* The `on_finish` callback function is executed for the trial +* The `on_trial_finish` callback function is executed +* The display element is cleared, and any timeouts that are pending are cleared. * The progress bar is updated if it is being displayed -* The experiment ends if the trial is the last one (and the on_finish callback function is executed). +* The experiment ends if the trial is the last one (and the `on_finish` callback function is executed). * The next trial, if one exists, is started. ### Example @@ -363,7 +328,7 @@ Returns the object describing the current trial. The object will contain all of ### Description -Get a description of the current trial +Get a description of the current trial. ### Example @@ -467,31 +432,6 @@ alert('You have completed approximately '+progress.percent_complete+'% of the ex ``` ---- -## jsPsych.getProgressBarCompleted - -```javascript -jsPsych.getProgressBarCompleted() -``` - -### Parameters - -None. - -### Return value - -Returns a value between 0 and 1 representing how full the progress bar currently is. - -### Description - -Used to get the current value of the progress bar. Works for automated and manual control. - -### Example - -```javascript -var progress_bar_amount = jsPsych.getProgressBarCompleted(); -``` - --- ## jsPsych.getStartTime @@ -570,9 +510,9 @@ Pauses the experiment. The experiment will finish the current trial, but will no var trial = { type: jsPsychHtmlKeyboardResponse, stimulus: 'Press p to take a 30 second break. Otherwise, press c to continue immediately.', - choices: ['p','c'], + choices: ['p', 'c'], on_finish: function(data){ - if(jsPsych.pluginAPI.compareKeys(data.response, "p")) { + if (jsPsych.pluginAPI.compareKeys(data.response, "p")) { jsPsych.pauseExperiment(); setTimeout(jsPsych.resumeExperiment, 30000); } @@ -648,35 +588,6 @@ jsPsych.run(timeline); --- -## jsPsych.setProgressBar - -```javascript -jsPsych.setProgressBar(value) -``` - -### Parameters - -| Parameter | Type | Description | -| --------- | ------- | ---------------------------------------- | -| value | numeric | Proprotion (between 0 and 1) to fill the progress bar. | - - -### Return value - -None. - -### Description - -Set the progress bar to a custom amount. Proportion must be between 0 and 1. Values larger than 1 are treated as 1. - -### Example - -```javascript -jsPsych.setProgressBar(0.85); -``` - ---- - ## jsPsych.timelineVariable ```javascript