I think this is a smart (and small) addition. It adds a lot of flexibility to how your event handlers respond to an event.
Though, I am having trouble coming up with a concrete example of what you might do with 'foo'. I suppose you could so something like:
- WidgetPlugins = {
- 'foo' : function(){ ... },
- 'bar' : function(){ ...}
- }
- $(".widget").bind("event", function(ev){
- run_default_event_stuff()
- WidgetPlugins[ev.namespace].apply(this, ev)
- })
Which would allow someone to add to WidgetPlugins and dispatch events to it without the author explicitly leaving a channel open for it.