"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TypedEventBus = void 0;
class TypedEventBus {
    handlers = new Map();
    on(event, handler) {
        const current = this.handlers.get(event) ?? new Set();
        current.add(handler);
        this.handlers.set(event, current);
    }
    emit(event, payload) {
        const current = this.handlers.get(event);
        if (!current) {
            return;
        }
        current.forEach((handler) => handler(payload));
    }
}
exports.TypedEventBus = TypedEventBus;
//# sourceMappingURL=typed-event-bus.js.map