Better way to maintain this reference on event listener functions

Mark Kennedy mkay581 at
Mon May 9 16:56:17 UTC 2016

Haha, no problem, Andrea. I think I may have not explained the scenario as
clearly in my original post so I apologize for that. But like Boris
mentioned, removing the event listeners in a much easier way is also a part
of my goal here.

I do like passing context in an argument and if using the third argument is
a possibility, that would be nice. I would vote for:

el.addEventListener('click', this.onClick, {context: this});

which would decrease the amount of code necessary imo.


Sent while riding a hoverboard... :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list