vue-obs-eventbus
vue-obs-eventbus
vue devtool listen on eventbus.
getting start
If you are using Vue 2, you need to install a plugin and inject the created eventbus at the root of the app:
import Vue from 'vue'
import App from './App.vue'
import { createEventBusDevToolsPlugin, EventBusDevToolsVue2Plugin } from 'vue-obs-eventbus'
Vue.use(EventBusDevToolsVue2Plugin)
new Vue({
eventbus: createEventBusDevToolsPlugin(),
render: h => h(App),
})
If you are using Vue 3, you need to create a eventbus instance and pass it to the app as a plugin:
import { createApp } from 'vue'
import App from './App.vue'
import { createEventBusDevToolsPlugin } from "vue-obs-eventbus"
const eventbus = createEventBusDevToolsPlugin()
createApp(App).use(eventbus).mount('#app')
create a eventbus
Define the event types into createEventBus.
import { createEventBus } from 'vue-obs-eventbus'
export const eventbus = createEventBus<{
'hello': number
}>('default')
you can use the eventbus by direct.
import { eventbus } from "./eventbus"
eventbus.emit('hello', 1)
eventbus.on('hello', (data) => {
console.log(data)
})
you also can hoist the eventbus into vue prototype.
// vue2
Vue.prototype.$eventBus = eventBus
// vue3
app.config.globalProperties.$eventBus = eventBus
and the use it by this in options api.
export default {
methods: {
emit(event, data) {
this.$eventbus.emit(event, data)
}
}
}
after use the eventbus, vue-obs-eventbus will collect the emit event and log it in the vue-devtools

Related Packages
@tanstack/vue-devtools
TanStack Devtools is a set of tools for building advanced devtools for your Vue...
100,583
507
@devframes/vite
Vite plugin for mounting a devframe inside any Vite-based host (Astro, SolidStar...
1,088,260
667
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 0.0.15 | ^2.6.14 || | MIT | |
| 0.0.14 | ^2.6.14 || | MIT | |
| 0.0.13 | ^2.6.14 || | MIT | |
| 0.0.12 | ^2.6.14 || | MIT | |
| 0.0.11 | ^2.6.14 || | MIT | |
| 0.0.10 | ^2.6.14 || | MIT | |
| 0.0.9 | ^2.6.14 || | MIT | |
| 0.0.8 | ^2.6.14 || | MIT | |
| 0.0.7 | ^2.6.14 || | MIT | |
| 0.0.6 | ^2.6.14 || | MIT | |
| 0.0.5 | ^2.6.14 || | MIT |