com.jtransc.game.event.EventDispatcher Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jtransc-media-game Show documentation
Show all versions of jtransc-media-game Show documentation
JVM AOT compiler currently generating Javascript and Haxe, with initial focus on Kotlin and games.
package com.jtransc.game.event;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
public class EventDispatcher {
public interface Handler {
void handle(T value);
}
private Map, ArrayList>> eventHandlers = new HashMap, ArrayList>>();
public void addEventListener(Class clazz, Handler handler) {
if (!eventHandlers.containsKey(clazz)) {
eventHandlers.put((Class