New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

chnl

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chnl

Simple and powerful javascript channels (events)

  • 0.1.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Simple and powerful javascript channels

Implementation of channels (events, pub/sub pattern) in plain javascript.
API is inspired by Chrome extensions events.

Installation

npm i chnl --save

Usage

/**
 * module A
 */

// import chnl
import Channel from 'chnl';

// create channel
exports.onChanged = new Channel();
...

// dispatch event when needed
exports.onChanged.dispatch(data);

/**
 * module B
 */
 
// import module A 
import moduleA from './moduleA';

// subscribe on channel
moduleA.onChanged.addListener(data => {
  console.log('moduleA.onChanged', data);
});

API

  • addListener
  • removeListener
  • hasListener
  • hasListeners
  • dispatch
  • mute
  • unmute

FAQs

Package last updated on 10 May 2016

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