URL of experiment: dscrimination [PsychoPy]
Problem description: the Javascript code is losing almost all the definition codes?(sorry I am not sure whether it is the name) (var ****) after I used the translation tool on psychopy, while the python code is totally ok and the experiment can run on my laptop perfectly. I added all the variables myself in the Javascript. However, the problem now is TypeError: Cannot use ‘in’ operator to search for ‘undefined’ in undefined . I have consulted many related topics but I can’t find any solution.
Could anyone help me with this issue? I almost run out of time for my master thesis. Thank you in advance!
https://discourse.psychopy.org/uploads/short-url/uHgcekThGqyEw5GBWOKJZHfsJVk.psyexp
// *opt4_2* updates
if (t >= 0.0 && opt4_2.status === PsychoJS.Status.NOT_STARTED) {
// keep track of start time/frame for later
opt4_2.tStart = t; // (not accounting for frame time here)
opt4_2.frameNStart = frameN; // exact frame index
opt4_2.setAutoDraw(true);
}
var _pj;
function _pj_snippets(container) {
function in_es6(left, right) {
if (((right instanceof Array) || ((typeof right) === "string"))) {
return (right.indexOf(left) > (- 1));
} else {
if (((right instanceof Map) || (right instanceof Set) || (right instanceof WeakMap) || (right instanceof WeakSet))) {
return right.has(left);
} else {
return (left in right);
}
}
}
container["in_es6"] = in_es6;
return container;
}
_pj = {};
_pj_snippets(_pj);
keys = psychoJS.eventManager.getKeys();
if (keys.length) {
if (_pj.in_es6("left", keys)) {
slider_2.markerPos = (slider_2.markerPos - 1);
} else {
if (_pj.in_es6("right", keys)) {
slider_2.markerPos = (slider_2.markerPos + 1);
}
}
}
psychoJS.experiment.addData("Rating", slider_2.markerPos);