You could do that in your event handler:
$('#a').bind('zoop', {foo:'bar'}, function(e, data){
$.extend(e.data, data);
console.log(e.data.foo);
});
$('#a').trigger('zoop', {foo:'big'});
For feature requests you should file a ticket here:http://
dev.jquery.com/newticket/
On Jun 7, 12:14 pm, sks <[email protected]> wrote:
> Hi,
> I'm a big fan of JQuery, it's totally changed the way I write
> Javascript.
>
> One thing it's started to make me do is to use custom events a lot
> more but something that has struck me is that the event.trigger seems
> to be somewhat inconsistent with the rest of the api in terms of
> passing variables around.
> The specific piece that I'm taking about is the event.data, when you
> bind things, you can incorporate the data into the call e.g.
>
> foo.bind("bar", {foo: bar}); - where foo becomes a property of
> event.data
>
> but when I trigger things I have to do this:
>
> foo.trigger("bar", [{foo: bar1}])
>
> and the extra data comes in as a second argument to the event being
> called.
>
> While this is quite useful functionality, I feel it does depart
> somewhat from the original, I would expect to pass in an object that
> could extend and overwrite the original event.data object as well as
> being able to pass in extra arguments, so it might look something more
> like this:
>
> foo.trigger("bar", {foo: bar1}, [{foo2: bar}];
>
> where the 2nd argument ({foo: bar1}) overwrites the original property
> ({foo: bar}) like
> jQuery.extend({}, event.data, latestData);
>
> I was wondering if there is any specific reason it is done this way &
> whether there is anywhere I could suggest that it is altered?
>
> Thanks
>
> Simon
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---