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 - npm Package Compare versions

Comparing version 0.2.2 to 0.2.3

2

package.json
{
"name": "chnl",
"version": "0.2.2",
"version": "0.2.3",
"description": "Chrome compatible javascript channels",

@@ -5,0 +5,0 @@ "main": "./es5/index.js",

@@ -21,3 +21,4 @@ # Chrome compatible javascript channels

## Channel
Channel is class that can attach/detach listeners and dispatch data to them.
Channel is class that can attach/detach listeners and dispatch data to them.
This allows to make more independent modules that just produce events in outer world.
API:

@@ -37,3 +38,2 @@

```js
// import es5 code
import Channel from 'chnl';

@@ -44,3 +44,3 @@

// dispatch event when needed
// dispatch event (and don't care if there module B and what it will do with event)
exports.onChanged.dispatch(data);

@@ -74,3 +74,3 @@ ```

Not all methods of original nodejs [EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter)
are supported but most popular:
are supported but most needed:

@@ -84,8 +84,6 @@ * addListener / on

```js
import Channel from 'chnl';
import {EventEmitter} from 'chnl';
// use as standalone object
const emitter = new EventEmitter();
const emitter = new Channel.EventEmitter();
emitter.on('event', data => console.log(data));

@@ -95,4 +93,3 @@ emitter.emit('event', 'hello world!'); // output 'hello world!'

// use as parent for some class
class MyClass extends EventEmitter {
class MyClass extends Channel.EventEmitter {
someMethod() {

@@ -117,2 +114,4 @@ this.emit('event', 'hello world!')

```js
import Channel from 'chnl';
this._subscription = new Channel.Subscription([

@@ -119,0 +118,0 @@ {

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