Simple events in Java
Switch branches/tags
Nothing to show
Latest commit e1f7e5a Dec 19, 2011 @MagnusS MagnusS ...
Failed to load latest commit information.

What is this

A simple event library written in Java.

Getting started

  1. Create an instance of the event manager.
SimpleEventManager eventsMgr = new SimpleEventManager();
  1. Get an event pipe from the event manager.
SimpleEventPipe pipe = eventMgr.getPipe("my-pipe");
  1. Register event listeners. Event listeners can be called synchronously in the same thread as the event was triggered or asynchronously in a separate thread. To create an asynchronous listener, replace SimpleEventListener with AsyncSimpleEventListener.
pipe.listen(new SimpleEventListener() {
	public void receiveEvent(SimpleEvent e) {
		System.out.println("In event listener!");
  1. Trigger events. Events are received by all listeners on this event pipe.
pipe.trigger(new SimpleEvent {});
  1. (optional) Create custom events by extending SimpleEvent. To separate between different event types, use instanceof in the listener or use different pipes.

That's all.

Magnus Skjegstad, 2011