Skip to content

The purpose of this demo is to demonstrate how to leverage the Composition API to add and use an event bus in your vue project

Notifications You must be signed in to change notification settings

owre/demo-vue-3-event-bus-using-the-composition-api

Repository files navigation

Demo: Vue Event Bus using the Composition API

The purpose of this demo is to demonstrate how to leverage the Composition API to add and use an event bus in your vue project

Read the article

src/components/MessagesList.vue

Component that lists messages that it receives from the event bus. It will clear messages from the list when it receives the 'clear-messages' event.

src/components/SendMessageForm.vue

Component that is responsible to emit the "message" event which the MessagesList component consumes.

src/composables/useEventBus.js

Holds the "core" logic. It utilizes tiny-emitter to emit and subscribe to events.

About

The purpose of this demo is to demonstrate how to leverage the Composition API to add and use an event bus in your vue project

Topics

Resources

Stars

Watchers

Forks