import EventEmitter from "events";

export default class EventBus extends EventEmitter {
  private static _instance: EventBus | null = null;

  public static getInstance() {
    if (!EventBus._instance) {
      EventBus._instance = new EventBus();
    }
    return EventBus._instance;
  }

  private constructor() {
    super();
    this.setMaxListeners(64);
  }
}

export namespace EventNamesDefine {
  export const UnKnow = "onUnKnow";
  export const WindowResize = "onWindowResize";
  export const WindowMouseDown = "onWindowMouseDown";
  export const WindowMouseMove = "onWindowMouseMove";
  export const WindowMouseUp = "onWindowMouseUp";
  export const WindowMouseOut = "onWindowMouseOut";
  export const DocumentBodyClick = "onDocumentBodyClick";
  export const ResponseMessage = "onResponseData";
  export const NotifyMessage = "onNotifyMessage";
  export const WebSocketClose = "onWebSocketClose";
  export const WebSocketError = "onWebSocketError";
  export const WebSocketConnected = "onWebSocketConnected";
  export const CurrentConnectDisconnect = "onCurrentConnectDisconnect";
  export const CurrentConnectConnected = "onCurrentConnectConnected";
  export const CurrentClientChanged = "onCurrentClientChanged";
  export const DropToWall = "onDropToWall";
  export const RefreshJointActionEquipmentList =
    "onRefreshJointActionEquipmentList";
  export const CheckDebug = "CheckDebug";
  export const CheckDebug2 = "CheckDebug2";
  export const NotifyDownloadAndroid = "NotifyDownloadAndroid";
}
