An event bus for Vue. Built using @crishellco/beam.
yarn add @crishellco/vue-beam
# or
npm i @crishellco/vue-beam
import Vue from 'vue';
import VueBeam from '@crishellco/vue-beam';
Vue.use(VueBeam);
// nuxt.config.js
{
modules: ['@crishellco/vue-beam/nuxt'];
}
<template>
<button @click="$beam.emit('submitted')">Submit</button>
</template>
// In a different component...
<script>
export default {
mounted() {
this.$beam.on('submitted', handleSubmit);
},
beforeDestroy() {
this.$beam.off('submitted', handleSubmit);
}
};
</script>
import { beam } from '@crishellco/vue-beam';
const bus = beam();
bus.emit('submitted');
See the @crishellco/beam docs for available methods and properties on $vm.$beam
.
yarn build
yarn test
- Fork the repository
- Create a new branch for each feature or improvement
- Send a pull request from each feature branch to the develop branch