On 11/27/06, Jörn Zaefferer <[EMAIL PROTECTED]> wrote:
> Currently I favor an interface that looks like this:
> $().bind("type of event", eventHandler, {amount: 5, data: additionalStuff})
> $().trigger("type of event", {bubble: true, data: moreStuff});
> This avoids any type checking of arguments and provides a clear API: A
> little bit more to type, yet less confusion when you need only one of
> the optional paramters.
>
> Possible interfaces for the event handlers:
> $().bind("click", function(event, bindData, triggerData) { ... });
> $().bind("click", function(event) {
>     event.bind // contains bind data
>     event.trigger // contains trigger data
> });
>
> Your opinions?

I think I prefer the suggestion made by Dave Methvin of using on() and
un() instead of bind.

$().on('click')
$().un('click')

Also maybe event.bind and event.trigger should have 'Data' appended to
the end to be more clear about what it is.

Also don't forget to clear out any added properties to the event
object in IE or it will leak.

--
Brandon Aaron

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

Reply via email to