mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 19:20:55 +00:00
rename instructions page_change_callback
to on_page_change
This commit is contained in:
parent
438a46953f
commit
1c1849ca6c
@ -20,7 +20,7 @@ In addition to the [parameters available in all plugins](../overview/plugins.md#
|
|||||||
| button_label_next | string | 'Next' | The text that appears on the button to go forwards. |
|
| button_label_next | string | 'Next' | The text that appears on the button to go forwards. |
|
||||||
| show_page_number | boolean | false | If true, and clickable navigation is enabled, then Page x/y will be shown between the nav buttons. |
|
| show_page_number | boolean | false | If true, and clickable navigation is enabled, then Page x/y will be shown between the nav buttons. |
|
||||||
| page_label | string | 'Page' | The text that appears before x/y pages displayed when show_page_number is true. |
|
| page_label | string | 'Page' | The text that appears before x/y pages displayed when show_page_number is true. |
|
||||||
| page_change_callback | function | ``function (current_page) {}`` | The function that is called every time the page changes. This function receives a single argument `current_page`, which is the index of the current page **after page change**, and starts at `0`. The function is also called when going forward from the last page, i.e., finishing the trial. |
|
| on_page_change | function | ``function (current_page) {}`` | The function that is called every time the page changes. This function receives a single argument `current_page`, which is the index of the current page **after page change**, and starts at `0`. The function is also called when going forward from the last page, i.e., finishing the trial. |
|
||||||
|
|
||||||
## Data Generated
|
## Data Generated
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ describe("instructions plugin", () => {
|
|||||||
{
|
{
|
||||||
type: instructions,
|
type: instructions,
|
||||||
pages: ["page 1", "page 2", "page 3"],
|
pages: ["page 1", "page 2", "page 3"],
|
||||||
page_change_callback: function (page_number: number) {
|
on_page_change: function (page_number: number) {
|
||||||
count[page_number]++;
|
count[page_number]++;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -65,7 +65,7 @@ const info = <const>{
|
|||||||
default: "Next",
|
default: "Next",
|
||||||
},
|
},
|
||||||
/** The callback function when page changes */
|
/** The callback function when page changes */
|
||||||
page_change_callback: {
|
on_page_change: {
|
||||||
type: ParameterType.FUNCTION,
|
type: ParameterType.FUNCTION,
|
||||||
pretty_name: "Page change callback",
|
pretty_name: "Page change callback",
|
||||||
default: function (current_page: number) {},
|
default: function (current_page: number) {},
|
||||||
@ -175,7 +175,7 @@ class InstructionsPlugin implements JsPsychPlugin<Info> {
|
|||||||
show_current_page();
|
show_current_page();
|
||||||
}
|
}
|
||||||
|
|
||||||
trial.page_change_callback(current_page);
|
trial.on_page_change(current_page);
|
||||||
}
|
}
|
||||||
|
|
||||||
function back() {
|
function back() {
|
||||||
@ -185,7 +185,7 @@ class InstructionsPlugin implements JsPsychPlugin<Info> {
|
|||||||
|
|
||||||
show_current_page();
|
show_current_page();
|
||||||
|
|
||||||
trial.page_change_callback(current_page);
|
trial.on_page_change(current_page);
|
||||||
}
|
}
|
||||||
|
|
||||||
function add_current_page_to_view_history() {
|
function add_current_page_to_view_history() {
|
||||||
|
Loading…
Reference in New Issue
Block a user