"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AppEventsFactory = void 0;
var events_1 = __importDefault(require("events"));
var AppEventsFactory = (function () {
    function AppEventsFactory() {
        this.eventEmitter = new events_1.default();
        this.eventEmitter.setMaxListeners(100000);
    }
    AppEventsFactory.getInstance = function () {
        if (!AppEventsFactory.instance) {
            AppEventsFactory.instance = new AppEventsFactory();
        }
        return AppEventsFactory.instance;
    };
    AppEventsFactory.prototype.sub = function (eventName, handler) {
        this.eventEmitter.on(eventName, handler);
    };
    AppEventsFactory.prototype.unSub = function (evenName, handler) {
        this.eventEmitter.removeListener(evenName, handler);
    };
    AppEventsFactory.prototype.pub = function (eventName, doc) {
        this.eventEmitter.emit(eventName, doc);
    };
    AppEventsFactory.prototype.connected = function (eventName) {
        return this.eventEmitter.listenerCount(eventName);
    };
    return AppEventsFactory;
}());
exports.AppEventsFactory = AppEventsFactory;
