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

Update knockout-postbox.js #41

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

eriksimonic
Copy link

I am doing a large knockout application and I had to implement this function, to dispose topics by topic name, it is very useful for handling dispose event and cleaning after yourself.

If it possible can you add it to the repo so I don't need to maintain a copy of the library/
Regards
Erik.

Added new function to dispose all topics by topic name.

Added new function to dispose all topics by topic name
@rniemeyer
Copy link
Owner

Thanks for this PR. It will need some tests and README updates as well. I'll try to get to them, if you don't get to them first.


//dispose all subscriptions by topic name.
exports.disposeTopic = function (topic) {
var sub = subscriptions[topic];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rniemeyer Arent subscriptions accessed using the subscription id instead of the topic ?

Compare https://github.com/rniemeyer/knockout-postbox/blob/master/src/knockout-postbox.js#L53 with this line...

Sorry, I am currently not in the situation to test this so I can be totally incorrect. In that case, just ignore my comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants