0👍
✅
You emit the name of the event, which can be anything you want. For example: bus.$emit('upload-image');
, and then you listen to this event and trigger your callback with:
bus.$on('upload-image', () => {
saveImage
.then(/* Do stuff */)
.catch(/* Do stuff */);
});`
For more information on how custom events work, you can refer to the documentation: https://v2.vuejs.org/v2/guide/components-custom-events.html
Source:stackexchange.com