getTime() not working in JS for Pavlovia

URL of experiment:

Description of the problem:
Hi! it is a self-paced reading study, at first it runs well locally. but when I posted on pavlovia, it showed " TypeError: core.Clock is not a constructor".
so I changed clock=core.Clock() to clock=new util.Clock()
but another problem pop up that “wordTime is not defined”
I have clock = new util.Clock in “begin routine”
and wordTime = clock.getTime() in “each frame”

I am very new to both psychopy and programming. I believe it should be some javaScript translation problem because it runs well on my laptop.
Thank you very much if anyone can help!

Try defining wordTime also in the begin routine tab (e.g. wordTime = 0;)

If that doesn’t work, try changing the name of your custom clock to myClock.

The word clock might be reserved for something else.

Thank you! I think it works! but then there is a following error after presenting the first two words of the first practice trial.
"TypeError:Cannot read properties of undefined (reading ‘slice’)
I didn’t change any other things and it runs well locally.

Thank you! I added myClock = 0 in “begin routine”, but then another error shows up after showing the first two words of the first practice trial
“TypeError:Cannot read properties of undefined (reading ‘slice’)”
I didn’t change any other things and it runs well locally.

Shouldn’t you be defining myClock as a clock, not an integer.

Please could you show your code components since I’m not clear on what you’re doing now.

You might also find my self paced reading online demo useful, and/or my clock code snippets.

Morys-Carter, W. L. & Alipour, Z. (2021, June 2). Self Paced Reading [Computer software]. Pavlovia. https://doi.org/10.17605/OSF.IO/S2FD6