ajacksified / ajacksified/Mediator.js

multiple once for the same subscriber

Aperta
#49 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
460
Fork
75
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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!"

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.