eventsystem 1.2.0

Super tiny event system using delegates


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

dub.json
dub.sdl

Tiny Event System

Its just 35 lines of code + unittests and it supports regular events & cancelable events!

Usage:

import tinyevent;

// Regular event
Event!string onStringChange;
static assert(isEvent!onStringChange);
static assert(isEmittable!onStringChange);
onStringChange ~= (str) { /* Handle new string */ };
onStringChange.emit("Foo");
import tinyevent;

// Cancelable
Cancelable!bool onQuit;
static assert(isCancelable!onQuit);
static assert(isEmittable!onQuit);
onQuit ~= (force) { return force || !saved; }

// When pressing X:
if(!onQuit.emit(false))
	showUnsavedChangesDialog();
else
	exit();

Authors: webfreak

Dependencies: none

Versions:
1.2.0 2017-Apr-11
1.1.0 2016-Jan-16
1.0.1 2015-Nov-15
1.0.0 2015-Oct-12
~master 2017-Apr-11
Show all 5 versions
Stats:
  • 0 downloads today

  • 1 downloads this week

  • 6 downloads this month

  • 135 downloads total