import ArenaEvent from '../helpers/ArenaEvent';
export default class EventManager {
    constructor(asm) {
        this.asm = asm;
        this.handlers = {};
    }
    fire(name, detail) {
        const event = new ArenaEvent(name, detail);
        this.asm.logger.log('fire', event);
        if (this.handlers[name]) {
            this.handlers[name].map((handler) => handler(event));
        }
        if (this.handlers['*']) {
            this.handlers['*'].map((handler) => handler(event));
        }
    }
    subscribe(event, handler) {
        if (!this.handlers[event]) {
            this.handlers[event] = [];
        }
        this.handlers[event].push(handler);
    }
}
//# sourceMappingURL=EventManager.js.map