Event constants for event listeners

Hi,

I would like to propose having common event names as constants on the Event class to prevent syntax errors and typos.

Currently we have this,

myButtonElement.addEventListener("click", eventHandler);

I would like to have something like this:


myButtonElement.addEventListener(Event.CLICK, eventHandler);

This is my first post. A few questions. Do I need to create the proposal on github first?

The language doesn't have events - HTML (the web) does. This discourse is just for the language. Try WHATWG or W3C.

1 Like