Skip to content

Rogue-striker/vue-signaler

Repository files navigation

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>

About

An EventBus for vue js version 3

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published