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.

-blair

Kolman Nándor wrote:
> What about using an object instead of an array?
>
> bind("click", handler, 1, {x: 1});
> bind("click", handler, {x: 1});
> ...
>
> Nandi
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of "Jörn 
> Zaefferer"
> Sent: Wednesday, November 15, 2006 1:22 PM
> To: jQuery Discussion.
> Subject: Re: [jQuery] jQuery 1.1 by the end of Nov
>
>>> Dunno how to handle the current oneEvents like oneclick: Extending bind
>> with an additonal parameter for the number of events to handle before the
>> handler should be removed would be one way, another to add a bindAmount() or
>> binds().
>>
>> Allowing a number of events to be defined before handler is removed 
>> would be very cool!
>
> I'm just not sure how this should be integrated into the existing API: Add a 
> new method, add parameter to bind? How to combine this with additional 
> parameters that are to be passed to the handler?
>
> Consider these:
> bind("click", handler) // normal
> bind("click", handler, 1) // only once
> bind("click", handler, 5) // five times
> bind("click", handler, [true, 5, "stuff"]) // pass additional argument to 
> handler
> bind("click", handler, true, 5, "stuff") // pass additonal arguments to 
> handler
> bind("click", handler, 1, [true, 5, "stuff"]) // ...
> bind("click", handler, 1, true, 5, "stuff") // ...
>
> I think the best approach would be to pass additional arguments always as an 
> Array. That allows the implementation to check for the type of the third and 
> fourth argument: If it's a number, use it as amount, if it is an array, use 
> it as additonal arguments.
>
> --
> Jörn Zaefferer
>
> http://bassistance.de

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

Reply via email to