Re: ECMAScript binding for EventListener

> --- Johnny Stenback <jst@netscape.com> wrote:
>
> Not necessarily.  However, something equivalently
> simple would be nice.  Jeff's idea works, but it isn't
> as clean as it should be.

As clean as it should be in what sense, the functionality exists, you
just have to use slightly different syntax:

Instead of: (from David Flanagan's post.)
element.addEventListener("click", { message: "Hello world",  handleEvent:
function(e) { alert(this.message); } },  false);

you just have
element.addEventListener("click", ({ message: "Hello world",
handleEvent: function(e) { alert(this.message); } }).handleEvent,
false);

It's not a lot of different, it's still reasonably neat.   I don't see
the point in making things more complicated for no reason, keep the
implementation simple, and small, and fast and only add features that are
truly of value, I'm still unsure as to exactly where this would be of
particular value - are there any non trivial examples?

Jim.

Received on Friday, 15 June 2001 10:48:16 UTC