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.5.0 to 0.6.0

dist/channel.cjs.js

43

package.json
{
"name": "chnl",
"version": "0.5.0",
"version": "0.6.0",
"description": "Implementation of event channels compatible with Chrome extensions events API",
"main": "./dist/bundle.umd.js",
"main": "dist/channel.cjs.js",
"module": "dist/channel.esm.js",
"types": "./types/index.d.js",

@@ -13,3 +14,3 @@ "author": {

"code": "eslint src test",
"test": "ava",
"test": "npm run build && ava",
"build": "rollup -c",

@@ -22,5 +23,5 @@ "ci": "npm run code && npm test",

"docs-commit": "npm run docs && git add docs && git commit -m\"docs\"",
"prerelease": "npm run code && npm run build && npm run test",
"prerelease": "npm run code && npm run test",
"postrelease": "npm run docs-commit && git push --follow-tags --no-verify",
"release": "npm version $VER && npm publish",
"postrelease": "npm run docs-commit && git push --follow-tags --no-verify",
"release-patch": "VER=patch npm run release",

@@ -39,17 +40,13 @@ "release-minor": "VER=minor npm run release"

"devDependencies": {
"@babel/preset-env": "^7.4.5",
"@babel/register": "^7.4.4",
"ava": "^2.1.0",
"babel-eslint": "^10.0.1",
"coveralls": "^3.0.4",
"documentation": "^11.0.1",
"eslint": "^5.16.0",
"eslint-plugin-ava": "^7.1.0",
"eslint-plugin-babel": "^5.3.0",
"husky": "^2.4.1",
"lint-staged": "^8.2.0",
"rollup": "^1.15.2",
"rollup-plugin-babel": "^4.3.2",
"rollup-plugin-banner": "^0.2.0",
"sinon": "^7.3.2"
"ava": "^2.4.0",
"coveralls": "^3.0.8",
"documentation": "^12.1.4",
"eslint": "^6.6.0",
"eslint-plugin-ava": "^9.0.0",
"husky": "^3.1.0",
"lint-staged": "^9.4.3",
"rollup": "^1.27.3",
"rollup-plugin-analyzer": "^3.2.2",
"rollup-plugin-banner": "^0.2.1",
"sinon": "^7.5.0"
},

@@ -60,8 +57,2 @@ "ava": {

],
"source": [
"src/*.js"
],
"require": [
"./test/_register.js"
],
"verbose": true

@@ -68,0 +59,0 @@ },

@@ -6,3 +6,3 @@ # chnl

Implementation of event channels (pub/sub, dispatcher, emitter) inspired and
Implementation of event channels (pub/sub, dispatcher, emitter) inspired and
compatible with [Chrome extensions events API](https://developer.chrome.com/extensions/events#type-Event).

@@ -38,3 +38,26 @@

### Adding/removing listeners in dispatching loop
Chnl makes a copy of the listeners before starting dispatching loop.
So modifying listeners list (adding/removing) in dispatching loop will affect only the next dispatch:
```js
const onData = new Channel();
const listener1 = () => console.log(1);
const listener2 = () => {
console.log(2);
onData.addListener(listener3);
};
const listener3 = () => console.log(3);
onData.addListener(listener1);
onData.addListener(listener2);
onData.dispatch();
// 1
// 2
onData.dispatch();
// 1
// 2
// 3
```
## License
MIT @ [Vitaliy Potapov](https://github.com/vitalets)
import banner from 'rollup-plugin-banner';
import babel from 'rollup-plugin-babel';
import analyze from 'rollup-plugin-analyzer';
import pkg from './package.json';
export default {
input: 'src/index.js',
output: {
file: 'dist/bundle.umd.js',
name: 'Channel',
format: 'umd'
export default [
{
input: 'src/index.js',
output: {
file: pkg.main,
format: 'cjs',
},
plugins: [
getBanner(),
analyze({summaryOnly: true}), // analyze once
]
},
plugins: [
babel({
exclude: 'node_modules/**'
}),
banner('<%= pkg.name %> v<%= pkg.version %> by <%= pkg.author.name %>')
]
};
{
input: 'src/index.js',
output: {
file: pkg.module,
format: 'es'
},
plugins: [
getBanner(),
]
}
];
function getBanner() {
return banner('<%= pkg.name %> v<%= pkg.version %> by <%= pkg.author.name %>');
}

@@ -144,3 +144,2 @@ const innerEvents = [

if (!this._mute) {
// ToDo: block adding/removing listeners to channel (throw an error) during dispatch operation
const listnersToInvoke = this._listeners.slice();

@@ -147,0 +146,0 @@ listnersToInvoke.forEach(listener => {

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