A vue plugin working as event bus.
yarn add v-hub
# or
npm install --save v-hub
// import
import vHub from 'v-hub';
Vue.use(vHub);
// use
created() {
this.$hub.on('EVENT_NAME', () => {
// ...
});
},
destroy() {
this.$hub.off();
}
.on
.once
.emit
.off