Wrapper for localStorage
This commit is contained in:
parent
b733215c5f
commit
5e3effc94d
1 changed files with 12 additions and 0 deletions
|
@ -23,3 +23,15 @@ export function getLocalStorageSummary() {
|
||||||
return 'inaccessible';
|
return 'inaccessible';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const localStorageAvailable = isLocalStorageAvailable();
|
||||||
|
|
||||||
|
export function getLocalStorageItem(key) {
|
||||||
|
return localStorageAvailable ? window.localStorage.getItem(key) : undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setLocalStorageItem(key, value) {
|
||||||
|
if (localStorageAvailable) {
|
||||||
|
window.localStorage.setItem(key, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue