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 17:32:07 -0600
Message-ID: <CABirCh_mJ46tOLvmfdPDxnoKHH_fgco8JbaZoBk+oQ9imU_1pw@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.

Returning an object with a method is a more common pattern on the
platform.  It also allows adding related features in the future without
contortions (eg. Prototype's also has start(), to re-add the listener).

Glenn Maynard
Received on Tuesday, 8 January 2013 23:32:34 UTC

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