hydra/src/main/state-manager.ts
Chubby Granny Chaser dc7591ee28 feat: removing sentry
2024-05-14 16:54:14 +01:00

29 lines
630 B
TypeScript

import type { Repack, SteamGame } from "@main/entity";
interface State {
repacks: Repack[];
steamGames: SteamGame[];
}
const initialState: State = {
repacks: [],
steamGames: [],
};
export class StateManager {
private state = initialState;
public setValue<T extends keyof State>(key: T, value: State[T]) {
this.state = { ...this.state, [key]: value };
}
public getValue<T extends keyof State>(key: T) {
return this.state[key];
}
public clearValue<T extends keyof State>(key: T) {
this.state = { ...this.state, [key]: initialState[key] };
}
}
export const stateManager = new StateManager();