mirror of https://github.com/freeCodeCamp/devdocs
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
687 B
34 lines
687 B
/*
|
|
* decaffeinate suggestions:
|
|
* DS102: Remove unnecessary code created because of implicit returns
|
|
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
|
|
*/
|
|
this.LocalStorageStore = class LocalStorageStore {
|
|
get(key) {
|
|
try {
|
|
return JSON.parse(localStorage.getItem(key));
|
|
} catch (error) {}
|
|
}
|
|
|
|
set(key, value) {
|
|
try {
|
|
localStorage.setItem(key, JSON.stringify(value));
|
|
return true;
|
|
} catch (error) {}
|
|
}
|
|
|
|
del(key) {
|
|
try {
|
|
localStorage.removeItem(key);
|
|
return true;
|
|
} catch (error) {}
|
|
}
|
|
|
|
reset() {
|
|
try {
|
|
localStorage.clear();
|
|
return true;
|
|
} catch (error) {}
|
|
}
|
|
};
|