Better way to maintain this reference on event listener functions

Mark Kennedy mkay581 at gmail.com
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:

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

which would decrease the amount of code necessary imo.
-- 

mark

Sent while riding a hoverboard...
heyimmark.com :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20160509/93e04e55/attachment.html>


More information about the es-discuss mailing list