Using a global event bus
[issue link]I want to create a global event bus with Nuxt, (see here). My first instinct was to create a middleware like this:
export default function () {
let eventBus = new Vue();
return eventBus;
}
But I don’t have access to the Vue instance in the middleware, I’m not sure where I can put the following code so I can emit and receive events across all pages/components.
I don’t really want to import a file into every single component/page that uses the event bus, as it defeats the object of it being globally accessible. Anyone know a way I can achieve this?
Thanks!