Hi Blair!

> Since this has come up again, I thought I'd mention - despite my distate 
> for plugin pimping - my own event++ system ( 
> http://jquery.offput.ca/event++ ) I wrote which could be used as the new 
> system. It can handle additional arguments sent to the event simply by 
> adding arguments to the event bind function call. It can also handle 
> limiting the number of event occurrence to run but as the first argument 
> to bind, click, et. al. It also handles scope arbitration using the 
> final argument provided to the event bind function call. There's a 
> little more detail available at the link above but regardless it seems 
> like it's a system people would appreciate and it barely adds any code 
> complexity to the current system.

Thanks, I'll keep that in mind.

It looks like there were some changes to the event system since you wrote your 
system, we have to be careful with those.

The additonal scope looks interesting, but rather useless. Do you have an 
example where that is really helping instead of only brain-twisting?

Please don't get me wrong, but that scope seems to be way too geeky.

By the way: We could simply allow Arrays and Objects for additonal argument: If 
it is a number, it's the amount of events to handle, otherwise its a 
pass-through argument.

Remains the question on how to actualy pass the additonal stuff, because:
var x = $(...).bind("click", handler, args);
x.trigger("click", moreArgs);

How to write the handler?

var handler = function(event, bind, trigger) {
  // do something with bind and trigger, we have to list bind also when using 
only trigger
};

var handler = function(event) {
  // do something with event.bind and event.trigger, they contain the data 
passed to bind and trigger, if any
};

I'd prefer the second approach. Documenting callback parameters is difficult 
anyway.

--
Jörn Zaefferer

http://bassistance.de
-- 
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to