ryansolid / dom-expressions

A Fine-Grained Runtime for Performant DOM Rendering
MIT License
863 stars 125 forks source link

The delegate "addEventListener", it cannot add multiple listeners #210

Closed GakkiiSmile closed 1 year ago

GakkiiSmile commented 1 year ago

and external users are easily misled into thinking that it is the same as DOM.addEventListener

GakkiiSmile commented 1 year ago

and I think we should also add a "removeEventListener" method.

snnsnn commented 1 year ago

I believe that is intentional for performance reasons. There are many ways to add multiple listeners, refs are the most common one.

https://stackoverflow.com/questions/73263711/how-to-perform-multiple-actions-when-clicking-on-a-button-component/74721079#74721079

ryansolid commented 1 year ago

This is internal API for JSX primarily so it is the equivalent to .onclick etc...