> > 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
--
"Ein Herz für Kinder" - Ihre Spende hilft! Aktion: www.deutschlandsegelt.de
Unser Dankeschön: Ihr Name auf dem Segel der 1. deutschen America's Cup-Yacht!
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/