The documentation page your message links to is outdated. The message at the top of the page invites you to consult the new documentation instead:
You are reading an outdated documentation. Please visit the new documentation instead.
That being said, the piece of code given in the documentation works well. The problem with your script is that you replaced the whole content of main.js with just that piece of code, instead of inserting it inside a
newTrial that would come after
PennController.ResetPrefix(null). I strongly encourage you to read the tutorial to get more familiar with PennController script