You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that if I subscribe twice to the same channel with the same subscriber with the "once" method, then if I "publish", the channel will be executed twice for the subscriber !
I thought "once" would have meant :
one subscription by subscriber, avoiding multiple subscriptions for the same subscriber.
when published once, then unsubscribed (that part is ok).
Example :
mediator.once("test", function () { print("Hello world!"); });
mediator.once("test", function () { print("Hello world!"); });
mediator.publish("test");
...seem to print :
"Hello world!" "Hello world!"
The text was updated successfully, but these errors were encountered:
I believe it is working as intended. Calling once, or any other subscribing function, creates a new instance of a Subscriber. So each subscriber is different, no matter if you pass in the same arguments. It is not the same subscriber being called twice, but two different subscribers being called once.
It seems that if I subscribe twice to the same channel with the same subscriber with the "once" method, then if I "publish", the channel will be executed twice for the subscriber !
I thought "once" would have meant :
Example :
mediator.once("test", function () { print("Hello world!"); });
mediator.once("test", function () { print("Hello world!"); });
mediator.publish("test");
...seem to print :
"Hello world!" "Hello world!"
The text was updated successfully, but these errors were encountered: