added StoragedState utill

This commit is contained in:
SrGooglo 2023-05-16 19:32:15 +00:00
parent 0e482d8d71
commit 1f465fe910

View File

@ -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,
})
}
}