Coaching Overlay Event Listener

In a JavaScript file, I am running a sequence of events where the user is prompted to find an image target which once found, hides the text. This uses the xrimageupdated event listener.

However, when trying to use the coaching overlay events using near-identical code, I am met with an error in the console and an infinitely spinning loading wheel of death. Any thoughts on how to fix this?

const removeOverlay = ({detail}) => {
  this.overlayDiv.style.display = 'none'
  mainObj.setAttribute('visible', true)
}

const coachEnd = () => {
  console.log('AHHH')
}

this.el.sceneEl.addEventListener('xrimageupdated', removeOverlay)
this.el.sceneEL.addEventListener('coaching-overlay.hide', coachEnd)

},

Error Message:
%ccore:a-node:error %cFailure loading node: %c color: red color: inherit color: red TypeError: undefined is not an object (evaluating β€˜this.el.sceneEL.addEventListener’)

Looks like you have a typo in your second addEventListener (capital L):

sceneEL β†’ sceneEl

Wow, just wow. Thank you very much.

1 Like