update docs to clarify #499

This commit is contained in:
Josh de Leeuw 2018-02-08 13:51:40 -05:00
parent 27f06b448c
commit d693d34d05
2 changed files with 3 additions and 1 deletions

View File

@ -295,7 +295,7 @@ The settings object can contain several parameters. The only *required* paramete
Parameter | Type | Description Parameter | Type | Description
--------- | ---- | ----------- --------- | ---- | -----------
timeline | array | An array containing the objects that describe the experiment timeline. See [Creating an Experiment: The Timeline](../overview/timeline.md). timeline | array | An array containing the objects that describe the experiment timeline. See [Creating an Experiment: The Timeline](../overview/timeline.md).
display_element | string | The ID of an HTML element to display the experiment in. If left blank, then jsPsych will use the `<body>` element to display content (creating it if necessary). You can override this parameter at the trial level as well by specifying a display_element property on any timeline. display_element | string | The ID of an HTML element to display the experiment in. If left blank, jsPsych will use the `<body>` element to display content (creating it if necessary). All keyboard event listeners are bound to this element. In order for a keyboard event to be detected, this element must have focus (be the last thing that the subject clicked on).
on_finish | function | Function to execute when the experiment ends. on_finish | function | Function to execute when the experiment ends.
on_trial_start | function | Function to execute when a new trial begins. on_trial_start | function | Function to execute when a new trial begins.
on_trial_finish | function | Function to execute when a trial ends. on_trial_finish | function | Function to execute when a trial ends.

View File

@ -266,6 +266,8 @@ Return an object that uniquely identifies the keyboard listener. This object can
Gets a keyboard response from the subject, recording the response time from when the function is first called until a valid response is generated. Gets a keyboard response from the subject, recording the response time from when the function is first called until a valid response is generated.
The keyboard event listener will be bound to the `display_element` declared in `jsPsych.init()` (or the `<body>` element if no `display_element` is specified). This allows jsPsych experiments to be embedded in websites with other content without disrupting the functionality of other UI elements.
A valid response triggers the `callback_function` specified in the parameters. A single argument is passed to the callback function. The argument contains an object with the properties `key` and `rt`. `key` contains the numeric key code of the response, and `rt` contains the response time. A valid response triggers the `callback_function` specified in the parameters. A single argument is passed to the callback function. The argument contains an object with the properties `key` and `rt`. `key` contains the numeric key code of the response, and `rt` contains the response time.
### Examples ### Examples