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

event-actions

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

event-actions

Application level event and action emitter

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

EventActions

Application level event and action emitter. Used to connect different components to each other by using common emitter for events and actions.

Events are used for notify listeners when something happens.

Actions are used to trigger things in other components.

Install

npm install event-actions

Usage


// get default EventHub instance
var actions = require('event-actions')();

// listen 'click' event from component A
actions.onEvent('A:click', function(button) {
    console.log('Component A was clicked with button ' + button);
});

// emit event
actions.emitEvent('A:click', 'Button 1');

// listen 'process' action
actions.onAction('B:process', function(a, b) {
    console.log('Processing values', a + b);
});

// emit action
actions.emitAction('B:process', 3, 5);

Namespacing

Namespacing actions and events is crusial, expecially when number of connected components grows.

In the future namespacing can be used to simplify things, such as removing all listeners from specific component.

FAQs

Package last updated on 04 Aug 2015

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