Closed redmagic closed 11 years ago
Hi @redmagic, I worked on a new test to try to duplicate your issue. It seems to unsubscribe correctly with the current functionality.
amplify.unsubscribe('myevent', y, y.doIt); //Will fail
That will certainly fail because you cannot pass in the context to the unsubscribe method currently. However, this works as expected:
amplify.unsubscribe( 'myevent', y.doIt )
@redmagic – Ah, nevermind, my test was not fully showing the problem. You are correct this is a bug.
@redmagic - Please download this version and see if it fixes your issues. Thanks for alerting us to the issue. I also adjusted the behavior for unsubscribe to unsubscribe all matching functions (and matching context if provided) instead of just the first one.
Hi Douglas,
Thanks for your quick response to this issue. I've tested the new build and it resolves the issue correctly.
Keep up the good work!
Hi,
When 2 subscribers are listening to a topic and have the same callback function, but are registered with different contexts, the unsubscribe will fail. The first listener will be unsubscribed.
Example:
Fix:
Check for context equality on unsubscribing: