I also got some great help from my friend Daniel Hindrikes to set up a devops flow that will help me manage pull requests and nuget-package publishing.
The features added to this version are;
- Publish with arguments
- Publish using fire-and-forget (with or without argument)
- Publish async (with or without argument)
Publish with argument
You can now subscribe and pass an argument of the type Action<string>
And publish it by simply adding another argument:
In order to keep it tiny we only allow for a single string argument at the moment. We did explore a whole bunch of alternatives, including generics and dynamic objects and stuff but we settled for this at the moment.
Publish using fire and forget (PublishAsTask)
Using a simple Publish in TinyPubSub is synchronous and will stop the execution flow until all the subscribers have executed their code. We've now added a way to publish events fire-and-forget style.
And the last way is to simply publish async. Works as expected.
await TinyPubSub.PublishAsync("test", "duck");
Git-hub project: https://github.com/johankson/TinyPubSub