Re: Better event listeners

On Wed, Jan 9, 2013 at 3:27 AM, Domenic Denicola
<> 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