Description

Super tiny event system using delegates

Package Information

Version1.1.0 (2016-Jan-16)
Repositoryhttps://github.com/WebFreak001/EventSystem
Licensepublic domain
CopyrightCopyright © 2015, webfreak
Authorswebfreak
Registered byWebFreak
Dependenciesnone

Installation

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

dub.json
dub.sdl

Readme

Tiny Event System

Its just 20 lines of code and it supports regular events & cancelable events!

Usage:

import tinyevent;

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

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

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

Available versions

1.1.0 1.0.1 1.0.0 ~master