import { EventEmitter } from "events" ; class AppEvent { private readonly event : EventEmitter = new EventEmitter ( ) ; public emitOnServerStarting ( ) { this . event . emit ( 'serverStarting' ) ; } public onServerStarting ( handler ) { this . event . on ( 'serverStarting' , handler ) ; } } export const appEvent = new AppEvent ( ) ;