amplify
amplify copied to clipboard
Not an issue, a suggestion... for pubsub
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;
}
}
}
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