You can get the .bind event namespace, but what about the .trigger namespace?

You can get the .bind event namespace, but what about the .trigger namespace?

So, you can get the .bind event namespace via event.handleObj.namespace, but what about the .trigger namespace? I don't see any way to get that value inside an event handler.

Right now, you can use event.type to have one callback handle multiple events. Now, imagine that you could use event.namespace to have one callback handle multiple namespaces as well... You could just $(elem).bind( 'event', fn ); and throw any number of namespaces at a function that programatically handles them all.

Like, do $(elem).trigger( 'event.foo' ); and fn could be all like "let's do something with this magical 'foo' value that i didn't have to know about in advance"

So, that being said, I propose a new event property: event.namespace.


Is there any value to doing this? Is this crazy talk?

- Ben


--
http://bit.ly/benalmandotcom - "There's a Ben Alman jQuery plugin for that"