Yes, you are missing something. This code will absolutely remove it the handler, because the handler being passed to both `addEventListener` and `removeEventListener is identical (in the `===` sense).
On Mon, May 9, 2016 at 10:50 PM, Mark Kennedy <[email protected]> wrote: > Thanks, Bob. Unless I'm missing something, this code you wrote will not > remove the event listener when `unlisten` is called. Check out [this > answer](http://stackoverflow.com/a/30448329/2810742) on stackoverflow. > > ```js > function listen(element, type, handler) { > element.addEventListener(type, handler); > return function() { > element.removeEventListener(type, handler); > }; > } > > var unlisten = listen(myElement, 'click', e => this.handler(e)); > > unlisten(); > ``` > -- > > mark > > Sent while riding a hoverboard... > heyimmark.com :) >
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

