Re: Better event listeners

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 UTC