From e9ea621b93fbb58d9edfca8375918791637bbd52 Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 30 Dec 2020 20:59:04 +0800 Subject: +init --- .../Impostor.Api/Events/Managers/IEventManager.cs | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Impostor-dev/src/Impostor.Api/Events/Managers/IEventManager.cs (limited to 'Impostor-dev/src/Impostor.Api/Events/Managers/IEventManager.cs') diff --git a/Impostor-dev/src/Impostor.Api/Events/Managers/IEventManager.cs b/Impostor-dev/src/Impostor.Api/Events/Managers/IEventManager.cs new file mode 100644 index 0000000..07a7f7c --- /dev/null +++ b/Impostor-dev/src/Impostor.Api/Events/Managers/IEventManager.cs @@ -0,0 +1,35 @@ +using System; +using System.Threading.Tasks; + +namespace Impostor.Api.Events.Managers +{ + public interface IEventManager + { + /// + /// Register a temporary event listener. + /// + /// Event listener. + /// Middleware between the events, which can be used to swap to the correct thread dispatcher. + /// Disposable that unregisters the callback from the event manager. + /// Type of the event listener. + IDisposable RegisterListener(TListener listener, Func, Task>? invoker = null) + where TListener : IEventListener; + + /// + /// Returns true if an event with the type is registered. + /// + /// True if the is registered. + /// Type of the event. + bool IsRegistered() + where TEvent : IEvent; + + /// + /// Call all the event listeners for the type . + /// + /// The event argument. + /// Type of the event. + /// A representing the asynchronous operation. + ValueTask CallAsync(TEvent @event) + where TEvent : IEvent; + } +} \ No newline at end of file -- cgit v1.1-26-g67d0