mikehostetler / amplify

AmplifyJS
http://amplifyjs.com
GNU General Public License v2.0
1.45k stars 144 forks source link

Def mode to prevent duplicate listeners per topic #123

Open mig82 opened 5 years ago

mig82 commented 5 years ago

I've found myself in situations where the same listener gets added more than once due to the navigation flows of an application. This causes the subscriptions map to grow without control. This change allows the developer to change the behaviour so that subscribe can be idempotent. Meaning that adding the same listener more than once to a topic only really adds it the first time.