URL of experiment: Joy Na / Inverted text recall · GitLab
Description of the problem:
Hello.
I am trying to get typed response in Korean, so I used custom code as below:
This runs fine on local computer, but I run into property ‘length’ problem on pavlovia.
var resplist;
var addKey;
function recallRoutineEachFrame(trials) {
return function () {
//------Loop for each frame of Routine 'recall'-------
let continueRoutine = true; // until we're told otherwise
// get current time
t = recallClock.getTime();
frameN = frameN + 1;// number of completed frames (so 0 is the first frame)
// update/draw components on each frame
resplist = psychoJS.eventManager.getKeys();
if (resplist) {
addKey = resplist[0];
if (addKey.length === 1) {
response += addKey;
} else if (addKey === "space") {
response += " ";
} else if (addKey === "backspace" && response.length > 0) {
response = response.slice(0, - 1);
} else if (addKey === "return") {
continueRoutine = false;
}
}
Above is from the javascript file, and it seems that addKey.length === 1 is what’s causing the problem.
How can I get this to work?
Thanks in advance!