I'm thinking of best practices for event bubbling in toolkitchen library. I have a nested markup with components and somewhere in this a button is pressed that should trigger an event somewhere in the hierarchy of components. This is an example, and I curious if there's a better way. Perhaps even a built in event system in toolkithcen lib itself.
// In one component
mouseClicked: function () {
var evt = new CustomEvent('ganttChartNewEventRequested');
document.dispatchEvent(evt);
}
// In another component
document.addEventListener('ganttChartNewEventRequested', function(e){
alert('create new event');
}, false);