ActionsΒΆ
Sometimes you need to tell other components about a change that happened in your dashboard. For example, a change in the underlying dashboard data after adding a new selection in the autocomplete.
This is handled through actions.
All components have a method called emit. Emit triggers actions and an onAction method that is automatically called when an action is fired from any component.
It’s worth mentioning the emit method returns a regular javascript object. By convention it should have an actionType but the rest is up to you.
@@TODO update / verify example
// Component emitting a change
onClick(){
this.emit({
actionType: 'CHANGE',
data: data
});
}
// Component receiving a change
onAction(action){
switch(action.actionType){
case 'CHANGE':
// Do some in
break;
}
}