Bob Myers (2016-05-09T17:10:11.000Z)
rtm at gol.com (2016-05-09T18:20:31.931Z)
I'm confused by this whole thread. There is nothing here that cannot be handled easily by a minimal amount of user glue code, to give just one example: ```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(); ``` To remove after one call: ```js function listenOnce(element, type, handler) { function _handler(e) { handler(e); element.removeEventListener(type, _handler); } element.addEventListener(type, _handler); } ``` If you want to more easily use the same handler on multiple elements: ```js function makeHandler(type, handler) { return { listen(elt) { elt.addEventListener (type, handler); }, unlisten(elt) { elt.removeEventListener(type, handler); } }; } var handler = makeHandler('click', e => this.handleIt(e)); handler.listen(elt); handler.unlisten(elt); ``` There are other useful possibilities opened up by using the `EventListener` interface. None of this requires any change to `addEventListener` signature as far as I can tell. And so on. Bob
rtm at gol.com (2016-05-09T18:12:16.294Z)
I'm confused by this whole thread. There is nothing here that cannot be handled easily by a minimal amount of user glue code, to give just one example: ```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(); ``` To remove after one call: ```js function listenOnce(element, type, handler) { function _handler(e) { handler(e); element.removeEventListener(type, _handler); } element.addEventListener(type, _handler); } ``` If you want to more easily use the same handler on multiple elements: ```js function makeHandler(type, handler) { return { listen(elt) { elt.addEventListener(type, handler) }, unlisten(elt) { elt.removeEventListener(type, handler); } }; } var handler = makeHandler('click', e => handleIt(e)); handler.listen(elt); handler.unlisten(elt); ``` There are other useful possibilities opened up by using the `EventListener` interface. None of this requires any change to `addEventListener` signature as far as I can tell. And so on. Bob