UNPKG

@lomray/react-mobx-manager

Version:
3 lines (2 loc) 408 B
class t{globalKey;storage;constructor({storage:t,globalKey:e}={}){this.storage=t??localStorage,this.globalKey=e??"stores"}get(){try{return JSON.parse(this.storage.getItem(this.globalKey)||"{}")}catch(t){return{}}}flush(){return this.storage.removeItem(this.globalKey)}set(t){return this.storage.setItem(this.globalKey,JSON.stringify(t||"{}"))}}export{t as default}; //# sourceMappingURL=local-storage.js.map