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

Re: Better event listeners

From: Anne van Kesteren <annevk@annevk.nl>
Date: Thu, 10 Jan 2013 13:39:11 +0100
Message-ID: <CADnb78hEV_czuRAfFjT8_+QS3fQwkMhsQHz-MwtiMMOqVh8=mg@mail.gmail.com>
To: Domenic Denicola <domenic@domenicdenicola.com>
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>
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.)

Received on Thursday, 10 January 2013 12:39:38 UTC

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