Best Alternative to Bus Events in Vue

1. Laying out an Example:

Imagine a straightforward layout with a multi-row table. Some columns get the server's reference data such as:

Car listing table
Team member's table
Make names table
Model names table

2. Exposing the Problem:

From the example above, the name displaying component would make 5 Make data requests and 5 Modal data requests.

3. The Common Solution

If you are a Vue developer, you have probably seen this solution to this issue before. You can easily find examples and tutorials on the web about Bus Events. If you are unfamiliar with this concept, look at this article.

4. An Alternative to Events

The following is a Vuex store in TS to handle data calls.

Find the code for easy copying and pasting at the end.
Find the code for easy copying and pasting at the end.
Find the code for easy copying and pasting at the end.
Find the code for easy copying and pasting at the end.

Conclusion

This store does not intend to make everything a Bus Event is capable of, but it substitutes a great deal of it. While a lot is happening under the hood within Bus, this is in plain sight and easily debugged.

--

--

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