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

Re: Better event listeners

From: Glenn Maynard <glenn@zewt.org>
Date: Tue, 8 Jan 2013 09:51:41 -0600
Message-ID: <CABirCh9OQyJU-5qAiGj-mh+_zjgMXfXS8smYuJyXWXi9DjjbjQ@mail.gmail.com>
To: Anne van Kesteren <annevk@annevk.nl>
Cc: Jake Verbaten <raynos2@gmail.com>, "www-dom@w3.org" <www-dom@w3.org>
On Tue, Jan 8, 2013 at 5:23 AM, Anne van Kesteren <annevk@annevk.nl> wrote:

> On Mon, Jan 7, 2013 at 6:18 PM, Jake Verbaten <raynos2@gmail.com> wrote:
> > Emphasis being on that `.on(...)` returns some kind of token that can be
> > used to remove the listener so we don't have to keep a reference to the
> > listener ourself somewhere.
>
> I think that makes a lot of sense. I like the idea of just returning a
> function reference.
>

I don't think there's much benefit to doing something unusual here.
 Returning an object with a method is the common pattern on the platform,
and doesn't assume we'll never want to add other related features in the
future (eg. Prototype's also has start(), to re-add the listener).

-- 
Glenn Maynard
Received on Tuesday, 8 January 2013 15:52:08 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2013 15:52:10 GMT