mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 19:20:55 +00:00
14 lines
562 B
JavaScript
14 lines
562 B
JavaScript
exports.pressKey = function(key){
|
|
document.querySelector('.jspsych-display-element').dispatchEvent(new KeyboardEvent('keydown', {keyCode: key}));
|
|
document.querySelector('.jspsych-display-element').dispatchEvent(new KeyboardEvent('keyup', {keyCode: key}));
|
|
}
|
|
|
|
exports.mouseDownMouseUpTarget = function(target){
|
|
target.dispatchEvent(new MouseEvent('mousedown', {bubbles: true}));
|
|
target.dispatchEvent(new MouseEvent('mouseup', {bubbles: true}));
|
|
}
|
|
|
|
exports.clickTarget = function(target){
|
|
target.dispatchEvent(new MouseEvent('click', {bubbles: true}));
|
|
}
|