URL of experiment: https://run.pavlovia.org/MJB/libet_keyentry/html/
Description of the problem:
I am trying to adapt the keyboard entry demo provided by @dvbridges for my experiment.
I want to restrict keyList of allowed keys to just numerical keys, return, and backspace.
The code below – adapted from the demo – throws an error because it does not like keyList. How do I use this in JS?
let theseKeys = psychoJS.eventManager.getKeys(keyList=['0','1','2','3','4','5','6','7','8','9','0','backspace','return']);
if (theseKeys.length > 0) { // at least one key was pressed
textAdd = theseKeys[theseKeys.length-1];
}
if (textAdd === 'return') {
textAdd = '';
continueRoutine = false;
} else if (textAdd === 'backspace') {
text.text = '';
textAdd = undefined;
estimateVale = 0;
handOri = 90;
} else if (textAdd !== undefined) {
text.text = text.text + textAdd;
estimateVale = Number.parseFloat(text.text);
handOri = ((estimateVale * 6) + 90);
textAdd = undefined;
}