diff --git a/packages/app/src/utils/storagedState/index.js b/packages/app/src/utils/storagedState/index.js new file mode 100644 index 00000000..17609c5f --- /dev/null +++ b/packages/app/src/utils/storagedState/index.js @@ -0,0 +1,24 @@ +import Dexie from "dexie" + +export default class StoragedState { + constructor() { + this.db = new Dexie("storaged_states") + + this.db.version(1).stores({ + states: "id,value", + }) + } + + getState = async (stateKey) => { + const data = await this.db.table("states").get(stateKey) + + return data.value + } + + setState = async (stateKey, value) => { + return await this.db.table("states").put({ + id: stateKey, + value, + }) + } +} \ No newline at end of file