mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-11 03:30:54 +00:00
10 lines
495 B
JavaScript
10 lines
495 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.clickTarget = function(target){
|
|
target.dispatchEvent(new MouseEvent('mousedown', {bubbles: true, detail: {target: target}}));
|
|
target.dispatchEvent(new MouseEvent('mouseup', {bubbles: true, detail: {target: target}}));
|
|
}
|