Comparing version 1.9.2 to 1.9.3
# Changes | ||
## 1.9.3 | ||
- [`a810919`](https://github.com/mroderick/PubSubJS/commit/a81091962dd4836da9da6dcf7aafeca4aeb9f815) | ||
Fix countSubscriptions | ||
> | ||
> This was introduced in ad93491c760ebc0429a7e9072b2747b2c2ce0a0a, but had | ||
> a bug that was not covered by unit tests. | ||
> | ||
_Released on 2021-02-18._ | ||
## 1.9.2 | ||
@@ -4,0 +15,0 @@ |
{ | ||
"name": "pubsub-js", | ||
"version": "1.9.2", | ||
"version": "1.9.3", | ||
"description": "Dependency free publish/subscribe library", | ||
@@ -5,0 +5,0 @@ "main": "./src/pubsub.js", |
@@ -254,6 +254,11 @@ /** | ||
var m; | ||
// eslint-disable-next-line no-unused-vars | ||
var token; | ||
var count = 0; | ||
for (m in messages){ | ||
if (Object.prototype.hasOwnProperty.call(messages, m) && m.indexOf(topic) === 0){ | ||
count++; | ||
for (m in messages) { | ||
if (Object.prototype.hasOwnProperty.call(messages, m) && m.indexOf(topic) === 0) { | ||
for (token in messages[m]) { | ||
count++; | ||
} | ||
break; | ||
} | ||
@@ -260,0 +265,0 @@ } |
@@ -19,2 +19,15 @@ 'use strict'; | ||
}); | ||
it('should count all subscriptions', function() { | ||
var topic = TestHelper.getUniqueString(), | ||
spy1 = sinon.spy(), | ||
spy2 = sinon.spy(); | ||
PubSub.subscribe(topic, spy1); | ||
PubSub.subscribe(topic, spy2); | ||
var counts = PubSub.countSubscriptions(topic); | ||
assert.equals(counts, 2); | ||
}); | ||
}); |
111922
1078