TypeError: core.quit is not a function

URL of experiment: https://run.pavlovia.org/xiaotong/vd_obj_a/html

Description of the problem: Hi, I use the code below to ask participants for their consent, but an ‘n’ response will not quit the experiment but trigger this error TypeError: core.quit is not a function. I remember it was working fine a month ago, but not 100% sure.

Python

if key_consent.keys != 'y':
core.quit()

JS

if ((key_consent.keys !== "y")) {
    core.quit();
}

Hi,

core.quit is not part of Javascript and the auto-translate unfortunately doesn’t recognise those commands yet.
Use psychoJS.quit instead (see https://github.com/psychopy/psychojs/blob/master/docs/core_PsychoJS.js.html and search for quit in the doc)

1 Like

Thanks! :grinning:

Dear Xiaotong,
Have you found any function to terminate the experiment?
Because I have also the same problem and I have received the ’ Core.quit() is not a function’ error message.
Please share the command which you used to terminate the experiment while running.
Many thanks,
Sumathi.

If you’re only having this problem online in Pavlovia, the answer above is correct. Change core.quit() to psychoJS.quit() and it should work no problem!

1 Like

Hi @Sumathi, yes as Eslifkin said, use psychoJS.quit() :slightly_smiling_face:

1 Like

Thank you for you prompt reply. I just found this few minutes ago and ran it successfully.
Many many thanks!
Cheers!
Sumathi.

Thank you so much!
It works well!

1 Like