Variables not declared in auto JS generation

URL of experiment: AudFlankTest_legacy [PsychoPy]

Description of the problem:
Hello all! I seem to keep receiving ReferenceErrors when attempting to run this experiment online. The variables never seem to be declared in the auto-generated JS file, which I seem to recall has been the case previously. For example, in the below snippet, currentLoop is never defined anywhere using var/let/etc.

async function updateInfo() {
  currentLoop = psychoJS.experiment;  // right now there are no loops
  ...
}

Any help would be appreciated, thanks!

I see you are using quite an old version: 2022.2.4

Do you have any loops?

Yeah the old version isn’t ideal, but sadly it’s what we have on the machines at the moment.

The experiment does have loops already - I did try wrapping the entire experiment in a loop but it didn’t seem to resolve the issue.

To clarify though, it’s not specifically the currentLoop variable, that just happens to be the first occurrence. Quite a few variables don’t seem to have a decleartion.

For example, if I use a breakpoint and the console to define currentLoop, it will continue and then throw an error for frameDur. Again, if I manually define that in the console the same happens with the next variable etc.

async function updateInfo() {
  currentLoop = psychoJS.experiment;  // right now there are no loops
  expInfo['date'] = util.MonotonicClock.getDateStr();  // add a simple timestamp
  expInfo['expName'] = expName;
  expInfo['psychopyVersion'] = '2022.2.4';
  expInfo['OS'] = window.navigator.platform;
  ...
  if (typeof expInfo['frameRate'] !== 'undefined')
    frameDur = 1.0 / Math.round(expInfo['frameRate']);
  else
    frameDur = 1.0 / 60.0; // couldn't get a reliable measure so guess
}

I could manually add declarations for all the variables to the JS file, but of course that isn’t ideal.

I think you have some form of compilation error. You shouldn’t need to define currentLoop and frameDur yourself.

It was indeed some custom code not being translated correctly and presumably causing a silent compilation error. Thanks for all your help!