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

Not an issue, a suggestion... for pubsub #113

Open
leolems opened this issue Jun 3, 2015 · 1 comment
Open

Not an issue, a suggestion... for pubsub #113

leolems opened this issue Jun 3, 2015 · 1 comment

Comments

@leolems
Copy link

leolems commented Jun 3, 2015

in the core, add:
To remove topics, i had a need for it, because i needed to reset

//================================================
// custom function LLS
//================================================
removeTopic: function(topic) {
    if ( typeof topic !== "string" ) {
        throw new Error( "You must provide a valid topic to remove it." );
    }

    for(var name in subscriptions) {
        if (name === topic) {
            delete subscriptions[topic];
            break; 
        }
    }
}
@leolems leolems changed the title Not an issue, a suggestion... Not an issue, a suggestion... for pubsub Jun 3, 2015
@bennycode
Copy link

Great idea!

We use amplify to build Wire for Web and also needed a solution to unsubscribe all callbacks for a specific topic. That's why I created a Pull Request (#118) which makes the following possible:

amplify.unsubscribeAll(); // Unsubscribes all callbacks for all topics
amplify.unsubscribeAll('ButtonClicked'); // Unsubscribes all callbacks for a specific topic

Reference: #118

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

No branches or pull requests

2 participants