Question · JavaScript and TypeScript course · Module 8: Events and the DOM

CustomEvent with Gesture Data

How do you pass additional data (e.g. the gesture direction) in a CustomEvent that you then send with dispatchEvent()?

Answer options

  • Through the data property of the CustomEvent object
  • Through the detail property in the CustomEvent options object
  • Through the second argument of dispatchEvent()
  • Through the global window.eventData object

You can check the correct answer by solving this task in the CodeWorlds game.