Releases: thedudxo/Venta
InterfaceEvents v2.0.1
- Resending an event after a subscriber threw an exception does not cause eventSender to throw a concurrent send exception.
- added
Subscribe(int priority, T item)
overload. Shouldn't change anything for you asSubscribe(int priority, params T items[])
already exists.
InterfaceEvents v2.0.0
Breaking Changes:
- sealed
EventSender<T>
Send()
throwsConcurrentSendException
instead ofInvalidOperationException
- Removed deprecated
EventSender<T>.EventSendMethod
no other functionality was modified.
Full Changelog: 1.5.0...2.0.0
InterfaceEvents v1.5
- Improved error stack trace when a subscription request was delayed.
- Added
TrySubscribe()
andTryUnsubscribe()
methods. both return bools, and will not throw exceptions if the item is already un/subscribed.
InterfaceEvents v1.4
Added Event Builder, used to set optional features.
This will create the default EventSender, same as using new EventSender()
:
EventSender<IOnEvent> myEvent = new EventBuilder<IOnEvent>()
.Build();
Deprecated EventSendMethod
enum and EvenSender.SendMethod
property.
use the builder instead:
EventSender<IOnEvent> myEvent = new EventBuilder<IOnEvent>()
.SendOnlyHighestPriority()
.Build();
You can also set the priority dictionary using the builder:
.WithPriorityDictionary(priorities);
Only notify once
This option will only alow an event to be sent once. after which:
- current subscribers are unsubscribed
- new subscribers are not subscribed, but instead receive the event immediately
this means that the EventSender holds no references to the subscribers after the event has been sent, so they may be garbage collected.
this option is usefull for delaying the creation of dependant objects untill thier dependancies have been created.
trying to send the event multiple times will throw a System.InvalidOperationException
.
EventSender<IOnEvent> myEvent = new EventBuilder<IOnEvent>()
.SendOnlyOnce()
.Build();
InterfaceEvents v1.3
Subscribe items to the same event in bulk.
Event.Subscribe(a, b);
Event.Subscribe(2, c, d, e);
Event.Unsubscribe(a, b, c, d, e);
InterfaceEvents v1.2
option to only notify subscribers with the highest priority.
MyEvent.SendMethod = EventSendMethod.OnlyHighestPriority;
InterfaceEvents v1.1
Type priority dictionaries let you specify what priority any instance of a type will be given when subscribing via eventSender.SubscribeByRegisteredType()
An item in the dictionary subscribed with eventSender.Subscribe()
will throw an exception.
public class MyPriorityDictionary : PriorityDictionary
{
public MyPriorityDictionary()
{
Add<ClassA>(0);
Add<ClassB>(After<ClassA>());
Add<ClassC>(Before<ClassB>());
}
}
public EventSender<ISetup> myEvent = new EventSender<ISetup>(new MyPriorityDictionary());
InterfaceEvents v1.0
Removed unessceary = null