Build codecov Maintainability

Vue Beam

An event bus for Vue. Built using @crishellco/beam.

Getting Started

Install Package

yarn add @crishellco/vue-beam
# or
npm i @crishellco/vue-beam

Add The Plugin To Your App

import Vue from 'vue';
import VueBeam from '@crishellco/vue-beam';


Vue.use(VueBeam);

Alternatively, Include As a Nuxt Module

// nuxt.config.js
{
  modules: ['@crishellco/vue-beam/nuxt'];
}

Usage

In Vue Component

<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>

Outside Of A Vue Component

import { beam } from '@crishellco/vue-beam';

const bus = beam();

bus.emit('submitted');

API

See the @crishellco/beam docs for available methods and properties on $vm.$beam.

Development

Build Dist

yarn build

Test

yarn test

How to Contribute

Pull Requests

  1. Fork the repository
  2. Create a new branch for each feature or improvement
  3. Send a pull request from each feature branch to the develop branch

License

MIT