amplify icon indicating copy to clipboard operation
amplify copied to clipboard

Not an issue, a suggestion... for pubsub

Open leolems opened this issue 9 years ago • 1 comments

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 avatar Jun 03 '15 08:06 leolems

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 (mikehostetler/amplify#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: https://github.com/mikehostetler/amplify/pull/118

bennycode avatar Aug 27 '15 13:08 bennycode