JSFiddle - React, Tailwind, and code Playground
JavaScript
enyo.kind({
name:"ex.Child",
handlers:{
someEvent:"catch"
},
components:[{content:"hi"}],
catch:function() {
this.log("caught someEvent by ",this.id);
}
});
enyo.kind({
name:"ex.Parent",
kind:"Control",
handlers:{
someEvent:"someEventHandler"
},
components:[
{kind:"Button", onclick:"send", content:"Send someEvent"},
{kind:"ex.Child", active:true},
{kind:"ex.Child", active:true},
{kind:"ex.Child", active:false},
{kind:"ex.Child", active:false},
{kind:"ex.Child", active:true}
],
someEventHandler:function(source, event) {
this.log("Parent catch");
var c$ = this.getControls();
for(var i=0, c;c=c$[i];i++) {
c.active && c.waterfall("someEvent", event, source);
}
return true;
},
send:function() {
this.waterfall("someEvent")
}
});
new ex.Parent().renderInto(document.body);