"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});const Logger_1=__importDefault(require("./Logger"));class BaseModule{constructor(e){this.moduleName=e,this.listeners=new Map,this.log=(e,...t)=>{"development"===process.env.ELECTRON_ENV&&console.log(...t),this.logger[e](...t)},this.logger=new Logger_1.default(e)}async install(e){this.execute=e.execute,this.registerEvents(e),await this.created()}created(){}registerEvents(e){}addEventListener(e,t){const s=this.listeners.get(e)||[];return s.length||this.listeners.set(e,s),s.push(t),()=>{this.listeners.set(e,s.filter(e=>e!==t))}}emit(e,t){const s=this.listeners.get(e);if(s)for(let e=0,r=s.length;e<r;e++){(0,s[e])(t)}}exec(e,...t){return this[e](...t)}}exports.default=BaseModule;