Better way to maintain this reference on event listener functions

Andrea Giammarchi andrea.giammarchi at gmail.com
Mon May 9 16:46:25 UTC 2016


Oh well, if removing after first click is the use-case,
`el.addEventListener('click',
this.onClick, {once: true})` is already in the standard pipeline (and
polyfilled in dom4)

Best Regards

On Mon, May 9, 2016 at 5:41 PM, Boris Zbarsky <bzbarsky at mit.edu> wrote:

> On 5/9/16 12:37 PM, Mark Kennedy wrote:
>
>> and also REMOVING the event listeners manually.
>>
>
> I think this is the key part.  What is the precise use case for removing
> here?  I think that affects how this would best be designed.
>
> The obvious case is when you want to remove the listener at the point when
> it fires.  This would be most easily addressed by providing a way to get at
> the listener from inside itself somehow.  Are there other uses?
>
> -Boris
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20160509/95de35bd/attachment.html>


More information about the es-discuss mailing list