Closed FlyingDR closed 12 years ago
You shouldn't bind multiple times if you don't want to listen multiple times.
It is not always possible to know if some callback is already bind, for example if it came as part of response on additional XHR request from server.
That's an issue in your application completely unrelated to pub/sub. If you have that problem, that means you never know if any code has been run for any type of initialization, which you need to solve some other way.
As of AmplifyJS v1.1.0 there is no check performed about if given callback is already subscribed to the topic. It leads to a problem of several calls to same callback upon message publishing. Possible way to avoid it is to add some kind of checking of callbacks uniqueness e.g. by using some kind of hash function for them.