ajacksified / ajacksified/Mediator.js

multiple once for the same subscriber

オープン
#49 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
JavaScript
スター
460
フォーク
75
PR マージ指標
30日以内にマージされた PR はありません

説明

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

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。