Library that adds C#-esque events to D.

How to use

import sev to use the Event and EventArgs classes.

To create a new event, do like this.

public Event MyNewEvent = new Event();

An event handler has the signature of void name

public void MyEventHandler (void* sender, EventArgs args) {
	//Do something.

Subscribe to an event by doing ~= (or += like in C#). Remember to use a pointer to the handler.

MyNewEvent ~= &MyEventHandler;
// You can also do this, if you are more used to the C# method.
MyNewEvent += &MyEventHandler;

To unsubscribe, use -=

MyNewEvent -= &MyEventHandler;

To invoke subscribed event handlers, run the class instance like a function. Remember to specify sender and arguments (cast to void*)

MyNewEvent(null, null);


If this small library has been of any help to you, consider Donating. c: