vue-signaler
v1.0.2
Published
Event bus for vue 3
Downloads
13
Maintainers
Readme
vue-signaler
A tiny eventbus library for vue 3
- It provides a plugin and composables for using event bus
- just simply plug it with your vue and it will take care of everything
- it's only 300 bytes (gzip)
installation
npm i vue-signaler
usage
To use the library in Vue 3
In the main.js file, import the eventBus and use it as plugin
<script>
import { eventBus } from 'vue-signaler'
app.use(eventBus)
</script>
In the components, we can access the eventBus using the composable useEventBus
<script>
import { useEventBus } from 'vue-signaler'
const { eventBus } = useEventBus();
eventBus.on('eventName', (data)=>{
console.log(data)
})
eventBus.emit('eventName' , { name : 'rogue-striker' })
</script>