TypeError: obj.contains is not a function when using variable clickable stimuli

Hi! Idk if it was posted earlier on the forum, but I found a workaround without editing the .js file and decided to leave it here in case someone needs it.

If you put ...clickable in the Clickable stimuli field for your Mouse component in the builder, it will generate the following JS code:

gotValidClick = false;
for (const obj of [...clickable]) {
  if (obj.contains(mouse)) {
    gotValidClick = true;
    mouse.clicked_name.push(obj.name)
  }
}

...clickable unpacks and [...clickable] turns into clickable

1 Like