I came across the following code and it obviously emit notification-alert
event and an object as a parameter
this.$root.$emit('notification-alert', {
text,
type: 'warning',
click: () => this.unselect(file),
});
What I don't understand is this line click: () => this.unselect(file)
click
is a callback that is passed as a property of event object to the place where this event is listened, where it can be called:
this.$root.$on('notification-alert', e => {
// calls this.unselect(file) in the context where click function was defined
e.click();
});