-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathevent-bus.js
13 lines (10 loc) · 884 Bytes
/
event-bus.js
1
2
3
4
5
6
7
8
9
10
11
12
13
//This code snippet is defining an event bus using Vue.js, a popular JavaScript framework for building user interfaces.
import Vue from 'vue'
//This line imports the Vue.js library. It assumes that you have Vue.js installed as a dependency in your project.
export const EventBus = new Vue()
//This line creates an event bus instance named EventBus using Vue.
//An event bus is a centralized communication system that allows different components in a Vue.js application
//to communicate with each other without the need for direct parent-child relationships.
//By using export, the EventBus instance is made available for use in other parts of the application.
//Other Vue components can import and use this EventBus to emit events and listen for events.
//Now, any component in your application can import the EventBus and use it to communicate with other components indirectly.