Skip to content

Commit

Permalink
Merge pull request #97 from jbutz/master
Browse files Browse the repository at this point in the history
Unsubscribe not removing hierarchy
  • Loading branch information
mroderick authored Oct 5, 2016
2 parents 7382c29 + cd405ea commit 4e6d888
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/pubsub.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ https://github.com/mroderick/PubSubJS
var PubSub = {};
root.PubSub = PubSub;
factory(PubSub);

}(( typeof window === 'object' && window ) || this, function (PubSub){
'use strict';

Expand Down Expand Up @@ -179,7 +179,7 @@ https://github.com/mroderick/PubSubJS
/*Public: Clear subscriptions by the topic
*/
PubSub.clearSubscriptions = function clearSubscriptions(topic){
var m;
var m;
for (m in messages){
if (messages.hasOwnProperty(m) && m.indexOf(topic) === 0){
delete messages[m];
Expand Down Expand Up @@ -214,7 +214,7 @@ https://github.com/mroderick/PubSubJS
m, message, t;

if (isTopic){
delete messages[value];
PubSub.clearSubscriptions(value);
return;
}

Expand Down
2 changes: 1 addition & 1 deletion test/test-unsubscribe.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@

PubSub.unsubscribe(topicB);

PubSub.publishSync(topicA, TestHelper.getUniqueString());
PubSub.publishSync(topicC, TestHelper.getUniqueString());

assert(spyA.called);
refute(spyB.called);
Expand Down

0 comments on commit 4e6d888

Please sign in to comment.