style: format static/player/storage.ts
This commit is contained in:
@@ -12,7 +12,9 @@ const getLocalStorage = (): StorageLike | null => {
|
|||||||
export const safeLocalStorage = {
|
export const safeLocalStorage = {
|
||||||
getItem(key: string): string | null {
|
getItem(key: string): string | null {
|
||||||
const storage = getLocalStorage();
|
const storage = getLocalStorage();
|
||||||
if (!storage) return null;
|
if (!storage) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
return storage.getItem(key);
|
return storage.getItem(key);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -22,7 +24,9 @@ export const safeLocalStorage = {
|
|||||||
},
|
},
|
||||||
setItem(key: string, value: string): void {
|
setItem(key: string, value: string): void {
|
||||||
const storage = getLocalStorage();
|
const storage = getLocalStorage();
|
||||||
if (!storage) return;
|
if (!storage) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
storage.setItem(key, value);
|
storage.setItem(key, value);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -31,7 +35,9 @@ export const safeLocalStorage = {
|
|||||||
},
|
},
|
||||||
removeItem(key: string): void {
|
removeItem(key: string): void {
|
||||||
const storage = getLocalStorage();
|
const storage = getLocalStorage();
|
||||||
if (!storage) return;
|
if (!storage) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
storage.removeItem(key);
|
storage.removeItem(key);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user