Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions FluffyVoid.EventBus/FluffyVoid.EventBus.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
<Description>Thread-safe C# event bus framework that allows for subscribing and publishing events in a decoupled method.</Description>
<Company>FluffyVoid</Company>
<Product>FluffyVoid.EventBus</Product>
<AssemblyVersion>1.0.4</AssemblyVersion>
<FileVersion>1.0.4</FileVersion>
<AssemblyVersion>1.0.5</AssemblyVersion>
<FileVersion>1.0.5</FileVersion>
<RepositoryUrl>https://github.com/ashiryn/EventBus</RepositoryUrl>
<Version>1.0.4</Version>
<Version>1.0.5</Version>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
Expand Down
24 changes: 22 additions & 2 deletions FluffyVoid.EventBus/LocalEventBus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,28 @@ public class LocalEventBus
/// threads
/// </summary>
private readonly object _threadLock = new object();

/// <summary>
/// Clears all events from the event bus, refreshing it for use
/// </summary>
public void Clear()
{
lock (_threadLock)
{
_events.Clear();
}
}
/// <summary>
/// Clears all subscribers from a single event
/// </summary>
/// <typeparam name="TEvent">The event type to clear from the event bus</typeparam>
public void Clear<TEvent>()
where TEvent : EventArgs
{
lock (_threadLock)
{
_events.Remove(typeof(TEvent));
}
}
/// <summary>
/// Returns the current count of subscribers for a desired event type
/// </summary>
Expand All @@ -38,7 +59,6 @@ public int Count<TEvent>()

return count;
}

/// <summary>
/// Publishes an event out to all subscribed listeners
/// </summary>
Expand Down
Loading