Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue-epic-bus

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-epic-bus

Bus plugin for vue.js

  • 0.1.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
98
increased by55.56%
Maintainers
1
Weekly downloads
 
Created
Source

vue-epic-bus

Emit and subscribe to global bus from your components

Gist

  • Minimal boilerplate.
  • Vue flavor.
  • Can't be used outside of vue components (intended).
  • No memory leaks.

Installation

  • Add to dependencies:
yarn add vue-epic-bus
// or
npm i vue-epic-bus
  • Install plugin
// main.js
import Vue from 'vue'
import {BusPlugin} from 'vue-epic-bus'
Vue.use(BusPlugin)

Usage

Subscribe:

<script>
export default {
  subs: {
    productUpdated (id) {
      console.log('Product updated', id)
    }
  },
}
</script>

Emit:

<script>
export default {
  methods: {
    productUpdated (id) {
      this.$cast('updated', id)
    }
  },
}
</script>

$cast could be used from template.

<button @click="$cast('updated', id)">Update</button>

If you're unhappy with default word choice for $cast and subs you can change it via plugin options:

Vue.use(BusPlugin, {
  optionGroupName: 'subs',
  broadcastName: '$cast',
})

FAQs

Package last updated on 03 Oct 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc