28 lines
753 B
TypeScript
28 lines
753 B
TypeScript
|
export interface missionStoreModel {
|
||
|
missionId: string;
|
||
|
doc: any;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @description store credentials to socket to prevent auth data change while connected
|
||
|
*/
|
||
|
export abstract class MissionMap {
|
||
|
private static store = new Map<string, missionStoreModel>();
|
||
|
|
||
|
public static write(identifier: string, data: missionStoreModel, overwrite: boolean = false): void {
|
||
|
if (!this.exists(identifier) || overwrite) this.store.set(identifier, data);
|
||
|
}
|
||
|
|
||
|
public static read(identifier: string): missionStoreModel {
|
||
|
return this.store.get(identifier);
|
||
|
}
|
||
|
|
||
|
public static exists(identifier: string): boolean {
|
||
|
return this.store.has(identifier);
|
||
|
}
|
||
|
|
||
|
public static delete(identifier: string): void {
|
||
|
this.store.delete(identifier);
|
||
|
}
|
||
|
}
|