I have a YUI widget ‘Container’ that contains widgets that subclass ‘Content’, in the Content class, i have :
Y.mynamespace.Content = Y.Base.create('content', Y.Widget, [],{
initializer : function(){
this.publish('select');
}
//..... the rest
})
so every subclass of Content can fire a ‘select’ event. Now I want my ‘Container’ widget to catch the ‘select’ event from all subclasses of Content by adding itself as the event target (content.addTarget()), however, to add an event listen, I have to add for every subclass of Content like :
this.on('content-subclass1:select',fn);
this.on('content-subclass2:select',fn);
this.on('content-subclass3:select',fn);
What I want is something like :
this.on('child:select',fn);
Is it possible? and how?
Thanks.
Yes, you can use
*as a wildcard for all subclasses:this.on('*:select', fn).