On 6/15/12 1:21 PM, Elliott Sprehn wrote: > Google Closure supports an additional final argument to addEventListener > that's the context the method is called with: > > target.addEventListener(event, fn, capture, context) > > So you could do > > target.addEventListener(event, this.handleClick, false, this); > > and later > > target.removeEventListener(event, this.handleClick, false, this); > > It'd be nice to get native support since it makes adding and removing > listeners easier. How is this different from doing: this.handleClick = this.handleClick.bind(this); once and then doing?: target.addEventListener(event, this.handleClick, false); ... target.removeEventListener(event, this.handleClick, false); -BorisReceived on Friday, 15 June 2012 17:29:46 UTC
This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:37:00 UTC