sharpevents 1.0.2

Library that adds C#-esque events to D.


To use this package, put the following dependency into your project's dependencies section:

dub.json
dub.sdl

sharpevents

Library that adds C#-esque events to D.

How to use

the Event class is localed in the sev.event module (short for sharpevents)

To create a new event, do like this.

public Event MyNewEvent = new Event();

An event handler has the signature of void [name] (void* sender, EventArgs args)

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

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

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);

Donations

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

Authors:
  • Clipsey
Dependencies:
none
Versions:
1.0.2 2018-May-13
1.0.1 2018-Mar-15
1.0.0 2018-Feb-27
~master 2018-May-13
Show all 4 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 3 downloads this month

  • 68 downloads total

Score:
0.3
Short URL:
sharpevents.dub.pm