@fewcha/web3-react
Version:
Check the documentation at https://docs.fewcha.app/
29 lines (21 loc) • 489 B
JavaScript
;
exports.__esModule = true;
exports.LocalStorage = void 0;
class LocalStorage {
constructor(reducerKey) {
this.reducerKey = "";
this.reducerKey = reducerKey;
}
get(defaultData) {
const data = localStorage.getItem(this.reducerKey);
if (data) {
return JSON.parse(data);
}
return defaultData;
}
set(data) {
localStorage.setItem(this.reducerKey, JSON.stringify(data));
return data;
}
}
exports.LocalStorage = LocalStorage;