Comparing version 1.8.0 to 1.9.0
# 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 @@ |
{ | ||
"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 |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
110351
22
1062