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
This does have some use cases, such as in a plugin/hook architecture. A way of doing this currently would be for each subscriber to touch a global variable, which doesn't seem all that nice.
I would suggest
if ( sync === true ){
deliver();
to change to:
if ( sync === true ){
return deliver();
and then each callSubscriber inside of deliverMessage to append to a list and return that, then subsequently deliverMessage to concatenate the lists. Returning an object may be better, with the keys denoting the message name. Eg:
The signature of .publishSync() would change slightly, but code doing a truthy/falsy check on its current return value (true/false) should still continue to work.
Thoughts?
The text was updated successfully, but these errors were encountered:
I know this is an old thread but my .02 on this is if the publisher (or anyone else) is interested in the work a subscriber is doing, that subscriber should publish on a different topic (event) with its results.
Would it be in the spirit of PubSub to add the ability to capture the return value of subscribers when doing synchronous publishes? Like so:
This does have some use cases, such as in a plugin/hook architecture. A way of doing this currently would be for each subscriber to touch a global variable, which doesn't seem all that nice.
I would suggest
to change to:
and then each callSubscriber inside of deliverMessage to append to a list and return that, then subsequently deliverMessage to concatenate the lists. Returning an object may be better, with the keys denoting the message name. Eg:
The signature of .publishSync() would change slightly, but code doing a truthy/falsy check on its current return value (true/false) should still continue to work.
Thoughts?
The text was updated successfully, but these errors were encountered: