DEV Community

Discussion on: Quick Tip: Managing event listeners with bound callbacks

Collapse
 
qm3ster profile image
Mihail Malo

In practical use, when would you be removing event listeners?
I feel like when you recycle elements, like an infinite list, event delegation should be used instead to prevent closure allocations.
And in the normal case, you just drop the element and its listeners get garbage collected with it.
There's probably a time to use this, but it's slipping my mind at the moment. Maybe something with scroll/draggables?
Also non-UI EventEmitters of course.

Also, manor should probably be manner