vue-signaler

1.0.2 • Public • Published

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>

/vue-signaler/

    Package Sidebar

    Install

    npm i vue-signaler

    Weekly Downloads

    5

    Version

    1.0.2

    License

    MIT

    Unpacked Size

    4.82 kB

    Total Files

    11

    Last publish

    Collaborators

    • rogue-striker