W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2013

Re: Better event listeners

From: Domenic Denicola <domenic@domenicdenicola.com>
Date: Thu, 10 Jan 2013 13:07:14 +0000
To: Anne van Kesteren <annevk@annevk.nl>
CC: Brandon Wallace <brandon.wallace@yahoo.com>, Jake Verbaten <raynos2@gmail.com>, Glenn Maynard <glenn@zewt.org>, "www-dom@w3.org" <www-dom@w3.org>
Message-ID: <E16B6828-C84E-49B0-B377-7A5EEA054A34@domenicdenicola.com>

On Jan 10, 2013, at 7:39, "Anne van Kesteren" <annevk@annevk.nl> wrote:

> On Wed, Jan 9, 2013 at 3:27 AM, Domenic Denicola
> <domenic@domenicdenicola.com> wrote:
>> What about just... "off"?
> Well that is the pattern some of the registration mechanism use,
> including addEventListener() today. However, it requires keeping track
> of all arguments passed. Or at least those that determine the "key"
> for what an event listener is (currently that would be type, callback,
> capture flag).
> It's already not that convenient to keep track of the callback, so
> maybe instead we should use a mechanism similar to setInternal() and
> friends. They return an integer you can later pass to a remove method.
> That doesn't seem quite as elegant as returning a function pointer
> however as per Jake's proposal. (Returning an object here with a
> method seems overkill to me.)
> -- 
> http://annevankesteren.nl/

I meant that, if an object with methods were returned, the method should be named "off" as opposed to "cancel" or "stop" etc. Agreed that a function instead of an object is more elegant, however.
Received on Thursday, 10 January 2013 13:08:00 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:20 UTC