import { FeedbackStatusEnum } from "@/enums"; const CacheMap: Record> = {}; class FeedBackStatus { current: number = 0; waitList: string[] = []; status: FeedbackStatusEnum = FeedbackStatusEnum.NONE; set(module: string, key: string, value: any) { if (!CacheMap[module]) { CacheMap[module] = {}; } CacheMap[module][key] = value; this.status = FeedbackStatusEnum.RUNNING; } get(module: string, key: string) { if (!CacheMap[module]) { return null; } return CacheMap[module][key]; } removeKey(module: string, key: string) { this.status = FeedbackStatusEnum.NONE; if (!CacheMap[module]) { return; } delete CacheMap[module][key]; } removeModule(module: string) { if (!CacheMap[module]) { return; } delete CacheMap[module]; } getAll() { return CacheMap; } getStatus() { return this.status; } setStatus(status: FeedbackStatusEnum) { this.status = status; } } const feedbackStatus = new FeedBackStatus(); export default feedbackStatus;