Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unsubscribe not removing hierarchy #97

Merged
merged 2 commits into from
Oct 5, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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