"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        if (typeof b !== "function" && b !== null)
            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
    if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
        if (ar || !(i in from)) {
            if (!ar) ar = Array.prototype.slice.call(from, 0, i);
            ar[i] = from[i];
        }
    }
    return to.concat(ar || Array.prototype.slice.call(from));
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CustomEventEmitter = void 0;
var lodash_1 = require("../shared/lodash");
var events_1 = require("events");
var CustomEventEmitter = (function (_super) {
    __extends(CustomEventEmitter, _super);
    function CustomEventEmitter() {
        var _this = _super.call(this) || this;
        _this.setMaxListeners(0);
        return _this;
    }
    CustomEventEmitter.prototype.emit = function (event) {
        var args = [];
        for (var _i = 1; _i < arguments.length; _i++) {
            args[_i - 1] = arguments[_i];
        }
        return _super.prototype.emit.call(this, event, lodash_1.assignIn.apply(void 0, __spreadArray([{ type: event }], args, false)));
    };
    CustomEventEmitter.prototype.bind = function (events, listener) {
        var _this = this;
        if ((0, lodash_1.isString)(events) && events.indexOf(' ') > 0) {
            events.split(' ').forEach(function (event) {
                _this.on(event, listener);
            });
            return this;
        }
        return this.on(events, listener);
    };
    return CustomEventEmitter;
}(events_1.EventEmitter));
exports.CustomEventEmitter = CustomEventEmitter;
//# sourceMappingURL=custom-event-emitter.js.map