spacebar_end_routine_after_rating.js 573 B

1234567891011121314151617181920212223
  1. let theseKeys = psychoJS.eventManager.getKeys({keyList:['space']});
  2. // check for quit:
  3. if (theseKeys.indexOf('escape') > -1) {
  4. psychoJS.experiment.experimentEnded = true;
  5. }
  6. if (theseKeys.length > 0) { // at least one key was pressed
  7. let completed_ratings = 0;
  8. for(var thisSlider of [mainSoundsratings]) {
  9. if (thisSlider.getRating() !== undefined) { // so equality check is with an undefined type, not string
  10. completed_ratings = completed_ratings + 1;
  11. }
  12. }
  13. if (completed_ratings === 1) {
  14. continueRoutine = false; // end now
  15. }
  16. }