https://github.com/trapcodeio/vue-ear
Simple fun to use vue event bus class for generating as many event listeners as you want.
https://github.com/trapcodeio/vue-ear
Last synced: 8 months ago
JSON representation
Simple fun to use vue event bus class for generating as many event listeners as you want.
- Host: GitHub
- URL: https://github.com/trapcodeio/vue-ear
- Owner: trapcodeio
- Created: 2019-04-12T20:03:33.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-20T03:02:06.000Z (almost 3 years ago)
- Last Synced: 2025-04-17T13:08:47.346Z (8 months ago)
- Language: TypeScript
- Size: 22.5 KB
- Stars: 4
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
## Vue Ear
A library that makes vue events fun to use.
Talk to any component from any component
#### Install Using Npm
```
npm install vue-ear
```
#### Install Using Yarn
```
yarn add install vue-ear
```
####
This doc is incomplete for now..
#### Example
```javascript
import VueEar from "vue-ear";
let userEvents = new VueEar('user');
let sideBarEvents = new VueEar('sidebar');
sideBarEvents.on('hide', ()=>{
// Hide Side Bar
})
userEvents.on('logoutWasClicked', ()=>{
// Hide Side bar
sideBarEvents.emit('hide');
// or talk to sidebar from anywhere in your app.
userEvents.talkTo('sidebar', 'hide');
})
// Triggers the user logoutWasClicked event
sideBarEvents.talkTo('user', 'logoutWasClicked');
```