I manually add and remove Eventlisteners on DOM-Elements for performance reasons from the ngZone in Angular. My implementation seems fine and I'm currently try to refactor code to keep it DRY and more readable. Now, my question is if there is a way to pass multiple DOM-Elements to the Renderer2.listen()
function. So basically I want to do something like this:
this._unlisten['mouseup'] = this._renderer.listen(
this.elementView.nativeElement, // <- Can I pass more elements than just elementView?
'mouseup',
(event) => {
unlistenToTheEventOnSeveralElements(event)
}
)
Thanks in advance for any ideas or suggestions.