New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unsubscribe from topic during publish() callback #21
Labels
Milestone
Comments
Here is the patch I made to my local copy (grimbo == me), though I'm sure someone could implement it better! publish():
removeNullSubscriptions():
unsubscribe():
|
Why don't you give an option to unsubscribe all callbacks of the topic (like in jquery core )? amplify.unsubscribe("items.loaded") for example. |
That's completely unrelated to this issue. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
If I try and unsubscribe my callback during the callback itself I get
the following error (in Firefox 6 - but I think browser is
irrelevant):
which is the 3rd line in this snippet:
I think this is happening because my call to unsubscribe is removing a
callback from subscriptions[ topic ], but the loop does not expect
this. Sample code as follows:
My question is, is there any way to have a callback unsubscribe itself
from a topic during it receiving the notification from publish?
Without it breaking this loop.
I want to do this as I only want to be notified of a particular topic
once, and don't want the subscription for the topic left registered
after this.
Cheers.
Paul.
The text was updated successfully, but these errors were encountered: