Prism icon indicating copy to clipboard operation
Prism copied to clipboard

[Enhancement] Support for async subscribers in the EventAggregator

Open james1301 opened this issue 6 months ago • 6 comments

Summary

Hi, as previously requested here: #832. Could this be reconsidered for implementation? Now that there is a AsyncDelegateCommand, it seems this would also be similarly useful. This increases test ability, without having to make subscribing methods public and creating async voids anonymous methods as a wrapper. It can still work as fire and forget when actually called.

API Changes

PubSubEvent.Subcribe(Func<Task> action); PubSubEvent.Unsubcribe(Func<Task> action);

Intended Use Case

For unit tests predominantly so that the subscribe method can be extracted through mocking the PubSubEvent, and subsequently called without making the method public.

Also reduces need for async voids and extra overhead of that.

james1301 avatar Aug 23 '24 11:08 james1301