2.4.1 • Published 4 years ago

vue-super-eventbus v2.4.1

Weekly downloads
56
License
ISC
Repository
github
Last release
4 years ago

vue-super-eventbus

An enhanced component of Vue event bus can be automatically destroyed without manual cancellation of subscription events, modularization, immutability of event data and many other features.

Install

npm i --save vue-super-eventbus

Usage

On Vue entry

import EventBus from "vue-super-eventbus"
Vue.use(EventBus)

In Vue component

// Recommend
on:{
  event1(data){
    // handle data
    console.log(data)
  },
  event2(data){
    // handle data
    console.log(data)
  }
},
// Or
created() {
  this.$bus.on(this, "event1", data => {
    // handle data
    console.log(data);
  });
  this.$bus.on(this, "event2", data => {
    // handle data
    console.log(data);
  });
},

In other Vue component

created() {
  this.$bus
    .emit("event1", 'test message')
    .emit("event2", { message: "test json message" });
}
beforeDestroy() {
  // No need to off the event, The lib take care of this for you.
}
2.4.1

4 years ago

2.4.0

4 years ago

2.3.0

4 years ago

2.1.1

4 years ago

2.0.0

4 years ago

1.1.0

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago