Yeah, I thought I'd have to use the data feature, it just seems a shame 
not to have a property on event that provides that info.

I did some digging in the jQuery source and found that i's trivial to 
expose the namespaced event type by inserting the following in to the 
handle() method before line 2059 in the current public release of 1.2.3:

event.namespaced = event.type;

With that added, all events then have a .namespaced property on the 
event parameter allowing you to see exactly which event was called and 
switch on it :)

I've submitted a feature request, including an example scenario and 
code: http://dev.jquery.com/ticket/2585

Guy


Andy Matthews wrote:
> You're allowed to pass in an array object along with each trigger 
> method call.
>  
> So this might work for you:
>  
> var call = 1;
> $('.foo').trigger('bar.update',[call]]);
>  
> var call = 2;
> $('.foo').trigger('bar.update',[call]]);
>  
> $('.foo').bind('bar', function(e,data) {
>     if (data[0] == 1) {
>         // I came from call 1
>     } else {
>         // i came from call 2
>     }
> });

Reply via email to