Skip to content

Releases: Enderlook/Net-Event-Manager

Enderlook.EventManager-v0.4.8

22 Feb 17:24
Compare
Choose a tag to compare
  • Stop using implementation details of runtimes in order to make the code safer and more compatible with other runtimes.
  • Fix nullability annotations.

Enderlook.EventManager-v0.4.7

02 Feb 13:42
Compare
Choose a tag to compare

Enderlook.EventManager-v0.4.6

24 Jan 15:45
Compare
Choose a tag to compare
  • Prevent .Shared.Dispose() from actually disposing the manager.
  • Fix bug when calling Raise<TEvent>(TEvent @event) method with an unregistered TEvent type.
  • Fix deadlock produced by the auto purging.

Enderlook.EventManager-v0.4.5

04 Jan 00:22
Compare
Choose a tag to compare
  • Add support for .NET 7.
  • Fix disposing and reuse of internal structures and callbacks during execution of Raise and DynamicRaise.
  • Improve performance by avoiding some array index checks.
  • Reduce code size in subscribe and unsubscribe methods to improve code quality and inlining in them.

Enderlook.EventManager-v0.4.4

06 Aug 13:20
Compare
Choose a tag to compare
  • Remove unnecessary aggressive inlining in Raise<TEvent>() method.
  • Remove static constructor from EventManager.
  • Fix errors in Subscribe and Unsubscribe methods using wrong parameters.
  • Fix error when subscribing methods in 64-bits architecture.

Enderlook.EventManager-v0.4.3

24 Jun 11:29
Compare
Choose a tag to compare
  • Fix and improve documentation.
  • Fix racing condition in DynamicRaise method.
  • Improve performance by avoiding some array index checks.
  • Improve incremental capabilities of auto purger when canceled.
  • Improve auto purger to avoid a small memory leak produced by storing some internal values in a static field.

Enderlook.EventManager-v0.4.2

22 May 17:02
Compare
Choose a tag to compare
  • Add support for trimming.
  • Improve internal array pool sharing (reduces memory consumption and allocation) in .NET >= 5.
  • Remove dependencies in .NET >= 5.
  • Replace System.Buffers and System.Runtime.CompilerServices.Unsafe for System.Memory dependency in .NET < 5.
  • Remove finalizer in EventManager.

Enderlook.EventManager-v0.4.1

12 Apr 21:10
Compare
Choose a tag to compare

Fix callbacks that listen to derived event types not being raised unless the derived type has at least one subscribed callback.

Enderlook.EventManager-v0.4.0

11 Apr 01:12
Compare
Choose a tag to compare
  • Increase performance on weak handles.
  • Increase constant propagation of certain branches.
  • Improve performance by avoiding covariance checks in arrays and reusing the pool of arrays.
  • Improve performance by replacing some virtual calls with direct calls or merging multiple virtual calls into a single one.
  • Use DependentHandle instead of GCHandle were possible on .NET 6 builds.
  • Add a timer to auto purger in .NET >= 5 taking into account memory pressure.
  • Improve auto purger cancellation capability.
  • Improve docummentation in Raise<TEvent>(TEvent) method.
  • Change APIs:
public sealed partial class EventManager : IDisposable
{
+   /// A shared default instance of the `EventManager`.
+   public static EventManager Shared { get; }

+   /// Raises event of type `argument.GetType()`, or `typeof(TEvent)` if `argument is null`.
+   public static void DynamicRaise<TEvent>(TEvent argument);

+   /// Raises event of type `typeof(TEvent)` with a new instance of `TEvent` using its parameterless constructor.
+   public void Raise<TEvent>() where TEvent : new();

+   /// Unsubscribes all actions.
+   public void Reset();

-    public void Subscribe<TEvent>(Action<TEvent> callback);
+    public void Subscribe<TEvent>(Action<TEvent> callback, SubscribeFlags subscribeAttributes = SubscribeFlags.Default);
-    public void Subscribe<TEvent>(Action callback);
+    public void Subscribe<TEvent>(Action callback, SubscribeFlags subscribeAttributes = SubscribeFlags.Default);
-    public void Unsubscribe<TEvent>(Action<TEvent> callback);
+    public void Unsubscribe<TEvent>(Action<TEvent> callback, SubscribeFlags subscribeAttributes = SubscribeFlags.Default);
-    public void Unsubscribe<TEvent>(Action callback);
+    public void Unsubscribe<TEvent>(Action callback, SubscribeFlags subscribeAttributes = SubscribeFlags.Default);

-    public void Subscribe<TClosure, TEvent>(TClosure closure, Action<TClosure, TEvent> callback);
+    public void Subscribe<TClosure, TEvent>(TClosure closure, Action<TClosure, TEvent> callback, SubscribeFlags subscribeAttributes = SubscribeFlags.Default);
-    public void Subscribe<TClosure, TEvent>(TClosure closure, Action<TClosure> callback);
+    public void Subscribe<TClosure, TEvent>(TClosure closure, Action<TClosure> callback, SubscribeFlags subscribeAttributes = SubscribeFlags.Default);
-    public void Unsubscribe<TClosure, TEvent>(TClosure closure, Action<TClosure, TEvent> callback);
+    public void Unsubscribe<TClosure, TEvent>(TClosure closure, Action<TClosure, TEvent> callback, SubscribeFlags subscribeAttributes = SubscribeFlags.Default);
-    public void Unsubscribe<TClosure, TEvent>(TClosure closure, Action<TClosure> callback);
+    public void Unsubscribe<TClosure, TEvent>(TClosure closure, Action<TClosure> callback, SubscribeFlags subscribeAttributes = SubscribeFlags.Default);

-    public void SubscribeOnce<TEvent>(Action<TEvent> callback);
-    public void SubscribeOnce<TEvent>(Action callback);
-    public void UnsubscribeOnce<TEvent>(Action<TEvent> callback);
-    public void UnsubscribeOnce<TEvent>(Action callback);

-    public void SubscribeOnce<TClosure, TEvent>(TClosure closure, Action<TClosure, TEvent> callback);
-    public void SubscribeOnce<TClosure, TEvent>(TClosure closure, Action<TClosure> callback);
-    public void UnsubscribeOnce<TClosure, TEvent>(TClosure closure, Action<TClosure, TEvent> callback);
-    public void UnsubscribeOnce<TClosure, TEvent>(TClosure closure, Action<TClosure> callback);

-    public void WeakSubscribe<THandle, TEvent>(THandle handle, Action<TEvent> callback, bool trackResurrection);
+    public void WeakSubscribe<THandle, TEvent>(THandle handle, Action<TEvent> callback, WeakSubscribeFlags subscribeAttributes = WeakSubscribeFlags.Default);
-    public void WeakSubscribe<THandle, TEvent>(THandle handle, Action callback, bool trackResurrection);
+    public void WeakSubscribe<THandle, TEvent>(THandle handle, Action callback, WeakSubscribeFlags subscribeAttributes = WeakSubscribeFlags.Default);
-    public void WeakSubscribe<THandle, TEvent>(THandle handle, Action<THandle, TEvent> callback, bool trackResurrection);
+    public void WeakSubscribe<THandle, TEvent>(THandle handle, Action<THandle, TEvent> callback, WeakSubscribeFlags subscribeAttributes = WeakSubscribeFlags.Default);
-    public void WeakSubscribe<THandle, TEvent>(THandle handle, Action<THandle> callback, bool trackResurrection);
+    public void WeakSubscribe<THandle, TEvent>(THandle handle, Action<THandle> callback, WeakSubscribeFlags subscribeAttributes = WeakSubscribeFlags.Default);
-    public void WeakUnsubscribe<THandle, TEvent>(THandle handle, Action<TEvent> callback, bool trackResurrection);
+    public void WeakUnsubscribe<THandle, TEvent>(THandle handle, Action<TEvent> callback, WeakSubscribeFlags subscribeAttributes = WeakSubscribeFlags.Default);
-    public void WeakUnsubscribe<THandle, TEvent>(THandle handle, Action callback, bool trackResurrection);
+    public void WeakUnsubscribe<THandle, TEvent>(THandle handle, Action callback, WeakSubscribeFlags subscribeAttributes = WeakSubscribeFlags.Default);
-    public void WeakUnsubscribe<THandle, TEvent>(THandle handle, Action<THandle, TEvent> callback, bool trackResurrection);
+    public void WeakUnsubscribe<THandle, TEvent>(THandle handle, Action<THandle, TEvent> callback, WeakSubscribeFlags subscribeAttributes = WeakSubscribeFlags.Default);
-    public void WeakUnsubscribe<THandle, TEvent>(THandle handle, Action<THandle> callback, bool trackResurrection);
+    public void WeakUnsubscribe<THandle, TEvent>(THandle handle, Action<THandle> callback, WeakSubscribeFlags subscribeAttributes = WeakSubscribeFlags.Default);

-    public void WeakSubscribe<THandle, TClosure, TEvent>(THandle handle, TClosure closure, Action<TClosure, TEvent> callback, bool trackResurrection);
+    public void WeakSubscribe<THandle, TClosure, TEvent>(THandle handle, TClosure closure, Action<TClosure, TEvent> callback, WeakSubscribeFlags subscribeAttributes = WeakSubscribeFlags.Default);
-    public void WeakSubscribe<THandle, TClosure, TEvent>(THandle handle, TClosure closure, Action<TClosure> callback, bool trackResurrection);
+    public void WeakSubscribe<THandle, TClosure, TEvent>(THandle handle, TClosure closure, Action<TClosure> callback, WeakSubscribeFlags subscribeAttributes = WeakSubscribeFlags.Default);
-    public void WeakSubscribe<THandle, TClosure, TEvent>(THandle handle, TClosure closure, Action<THandle, TClosure, TEvent> callback, bool trackResurrection);
+    public void WeakSubscribe<THandle, TClosure, TEvent>(THandle handle, TClosure closure, Action<THandle, TClosure, TEvent> callback, WeakSubscribeFlags subscribeAttributes = WeakSubscribeFlags.Default);
-    public void WeakSubscribe<THandle, TClosure, TEvent>(THandle handle, TClosure closure, Action<THandle, TClosure> callback, bool trackResurrection);
+    public void WeakSubscribe<THandle, TClosure, TEvent>(THandle handle, TClosure closure, Action<THandle, TClosure> callback, WeakSubscribeFlags subscribeAttributes = WeakSubscribeFlags.Default);
-    public void WeakUnsubscribe<THandle, TClosure, TEvent>(THandle handle, TClosure closure, Action<TClosure, TEvent> callback, bool trackResurrection);
+    public void WeakUnsubscribe<THandle, TClosure, TEvent>(THandle handle, TClosure closure, Action<TClosure, TEvent> callback, WeakSubscribeFlags subscribeAttributes = WeakSubscribeFlags.Default);
-    public void WeakUnsubscribe<THandle, TClosure, TEvent>(THandle handle, TClosure closure, Action<TClosure> callback, bool trackResurrection);
+    public void WeakUnsubscribe<THandle, TClosure, TEvent>(THandle handle, TClosure closure, Action<TClosure> callback, WeakSubscribeFlags subscribeAttributes = WeakSubscribeFlags.Default);
-    public void WeakUnsubscribe<THandle, TClosure, TEvent>(THandle handle, TClosure closure, Action<THandle, TClosure, TEvent> callback, bool trackResurrection);
+    public void WeakUnsubscribe<THandle, TClosure, TEvent>(THandle handle, TClosure closure, Action<THandle, TClosure, TEvent> callback, WeakSubscribeFlags subscribeAttributes = WeakSubscribeFlags.Default);
-    public void WeakUnsubscribe<THandle, TClosure, TEvent>(THandle handle, TClosure closure, Action<THandle, TClosure> callback, bool trackResurrection);
+    public void WeakUnsubscribe<THandle, TClosure, TEvent>(THandle handle, TClosure closure, Action<THandle, TClosure> callback, WeakSubscribeFlags subscribeAttributes = WeakSubscribeFlags.Default);

-    public void WeakSubscribeOnce<THandle, TEvent>(THandle handle, Action<TEvent> callback, bool trackResurrection);
-    public void WeakSubscribeOnce<THandle, TEvent>(THandle handle, Action callback, bool trackResurrection);
-    public void WeakSubscribeOnce<THandle, TEvent>(THandle handle, Action<THandle, TEvent> callback, bool trackResurrection);
-    public void WeakSubscribeOnce<THandle, TEvent>(THandle handle, Action<THandle> callback, bool trackResurrection);
-    public void WeakUnsubscribeOnce<THandle, TEvent>(THandle handle, Action<TEvent> callback, bool trackResurrection);
-    public void WeakUnsubscribeOnce<THandle, TEvent>(THandle handle, Action callback, bool trackResurrection);
-    public void WeakUnsubscribeOnce<THandle, TEvent>(THandle handle, Action<THandle, TEvent> callback, bool trackResurrection);
-    public void WeakUnsubscribeOnce<THandle, TEvent>(THandle handle, Action<THandle> callback, bool trackResurrection);

-    public void WeakSubscribeOnce<THandle, TClosure, TEvent>(THandle handle, TClosure closure, Action<TClosure, TEvent> callback, bool trackResurrection);
-    public void WeakSubscribeOnce<THandle, TClosure, TEvent>(THandle handle, TClosure closure, Action<TClosure> callback, bool trackResurrection);
-    public void WeakSubscribeOnce<THandle, TClosure, TEvent>(THandle handle, TClosure closur...
Read more

Enderlook.EventManager-v0.3.1

15 Sep 19:02
Compare
Choose a tag to compare
  • Reduce assembly size.
  • Reduce instance of EventManager size.
  • Reduce the number of required allocations.
  • Reduce initial cost by using lazy initialization.