Hi Albert, sorry for late response. I was on a family vacation for almost a month.

Is EventBus considered a “hack” shortcut?
I don’t think so. It’s an alternative way of communicating between components. Actually, EventBus follows the PubSub concept you have mentioned. I have seen the term EventBus many times in my life and I like how it communicates it’s purpose, to carry events from one part of the application to others. Like a bus.
In my opinion, EventBus has some advantages in a small to medium size applications. First, it’s not tied to a particular parent component. So with EventBus, we can pass events between multiple components living in different parents. Second, it’s easier to implement compared to vuex.

I see EventBus as the same pattern as PubSub concept, so it doesn’t have to be Vue instance?
First, as I mentioned EventBus follows the PubSub approach, so yes it’s basically the same.
Second, it doesn’t have to be a Vue instance you can use the PubSub snippet as in the gist. I use Vue instance because in Vue application we have access to Vue instance by default. And secondly, I don’t have to deal with all the logic behind PubSub as it’s already built into Vue. That’s why I can focus on my applications business logic instead of maintaining some business logic’s utility/supporting code.

So, when I would switch from EventBus as Vue instance to 3rd party solution?
If I would notice some performance issues with Vue’s approach, only then I would consider bringing a 3rd party PubSub library. But as I stated that this EventBus approach suits best for small to medium size applications, I don’t think I would run in such a situation.

Once again, thanks for your comment Albert. If there’s anything I’ve got wrong or you want me to explain better just ping me.

Cheers!

Writing JS, TS, Vue, #C, and fostering teams to release customer value n-times a day. Creator of billid.app and writer on abrickis.me

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store