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

pubsub-js

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pubsub-js - npm Package Compare versions

Comparing version 1.8.0 to 1.9.0

test/test-subscribeAll.js

7

CHANGES.md
# Changes
## 1.9.0
- [`3fb21e3`](https://github.com/mroderick/PubSubJS/commit/3fb21e309f8bb9fd32906b25b3a607bc32e8b1a7)
Add `subscribeAll` method (Subin Varghese)
_Released on 2020-08-17._
## 1.8.0

@@ -4,0 +11,0 @@

10

package.json
{
"name": "pubsub-js",
"version": "1.8.0",
"version": "1.9.0",
"description": "Dependency free publish/subscribe library",

@@ -39,8 +39,8 @@ "main": "./src/pubsub.js",

"eslint": "4.19.1",
"jsdoc-to-markdown": "^4.0.1",
"mocha": "5.1.1",
"nyc": "11.7.1",
"jsdoc-to-markdown": "^5.0.3",
"mocha": "7.1.0",
"nyc": "15.0.0",
"referee": "^1.2.0",
"sinon": "5.0.3"
"sinon": "9.0.0"
}
}

@@ -35,3 +35,4 @@ /**

var messages = {},
lastUid = -1;
lastUid = -1,
ALL_SUBSCRIBING_MSG = '*';

@@ -103,8 +104,17 @@ function hasKeys(obj){

}
deliverMessage(message, ALL_SUBSCRIBING_MSG, data, immediateExceptions);
};
}
function hasDirectSubscribersFor( message ) {
var topic = String( message ),
found = Boolean(messages.hasOwnProperty( topic ) && hasKeys(messages[topic]));
return found;
}
function messageHasSubscribers( message ){
var topic = String( message ),
found = Boolean(messages.hasOwnProperty( topic ) && hasKeys(messages[topic])),
found = hasDirectSubscribersFor(topic) || hasDirectSubscribersFor(ALL_SUBSCRIBING_MSG),
position = topic.lastIndexOf( '.' );

@@ -115,3 +125,3 @@

position = topic.lastIndexOf( '.' );
found = Boolean(messages.hasOwnProperty( topic ) && hasKeys(messages[topic]));
found = hasDirectSubscribersFor(topic);
}

@@ -193,2 +203,6 @@

PubSub.subscribeAll = function( func ){
return PubSub.subscribe(ALL_SUBSCRIBING_MSG, func);
};
/**

@@ -195,0 +209,0 @@ * Subscribes the passed function to the passed message once

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