In my VueJS app I have a Vue instance which I'm using as an event bus for sending data between components.
It's just this:
import Vue from 'vue';
export const EventBus = new Vue();
Then in my components I import EventBus and use EventBus.$emit()
and EventBus.$on()
.
This approach is explained here: https://alligator.io/vuejs/global-event-bus/
What I'd like to be able to do is listen to any event that is sent through EventBus. If I could bind one listener to all events I could use this for logging or to feed data into some system for my development environment that would show me all data as it went into eventBus, which would be super useful.
Is there any type of vm.$listenToEverything()
that I'm missing or some way to make this work?
Vue.prototype.$emit
to your own liking... – Terry