Add auto save and load

This commit is contained in:
Aslan 2025-12-23 07:56:01 -05:00
parent 9cabbc8813
commit 93ac1a980e
4 changed files with 11 additions and 2 deletions

View file

@ -13,11 +13,15 @@ const load = () => {
return;
}
console.log("loading data...");
const json = readFileSync(config.storePath).toString();
state = JSON.parse(json) as IState;
};
const save = () => {
console.log("saving data...");
const json = JSON.stringify(state);
writeFileSync(config.storePath, json);
};