diff --git a/FluffyVoid.EventBus/FluffyVoid.EventBus.csproj b/FluffyVoid.EventBus/FluffyVoid.EventBus.csproj index 4014682..5816d87 100644 --- a/FluffyVoid.EventBus/FluffyVoid.EventBus.csproj +++ b/FluffyVoid.EventBus/FluffyVoid.EventBus.csproj @@ -13,10 +13,10 @@ Thread-safe C# event bus framework that allows for subscribing and publishing events in a decoupled method. FluffyVoid FluffyVoid.EventBus - 1.0.4 - 1.0.4 + 1.0.5 + 1.0.5 https://github.com/ashiryn/EventBus - 1.0.4 + 1.0.5 diff --git a/FluffyVoid.EventBus/LocalEventBus.cs b/FluffyVoid.EventBus/LocalEventBus.cs index f0cc0a1..0aa2b22 100644 --- a/FluffyVoid.EventBus/LocalEventBus.cs +++ b/FluffyVoid.EventBus/LocalEventBus.cs @@ -17,7 +17,28 @@ public class LocalEventBus /// threads /// private readonly object _threadLock = new object(); - + /// + /// Clears all events from the event bus, refreshing it for use + /// + public void Clear() + { + lock (_threadLock) + { + _events.Clear(); + } + } + /// + /// Clears all subscribers from a single event + /// + /// The event type to clear from the event bus + public void Clear() + where TEvent : EventArgs + { + lock (_threadLock) + { + _events.Remove(typeof(TEvent)); + } + } /// /// Returns the current count of subscribers for a desired event type /// @@ -38,7 +59,6 @@ public int Count() return count; } - /// /// Publishes an event out to all subscribed listeners ///