2022-02-22 22:52:50 +01:00
|
|
|
export function setItem(k: string, v: string): void {
|
|
|
|
return localStorage.setItem(k, v)
|
|
|
|
}
|
|
|
|
export function getItem(k: string): string | null
|
|
|
|
export function getItem(k: string, defaultValue: any): string
|
|
|
|
export function getItem(k: string, defaultValue?: any): string | null {
|
2022-02-24 22:10:07 +01:00
|
|
|
const val = localStorage.getItem(k)
|
|
|
|
if (defaultValue !== undefined && val === null) {
|
|
|
|
return defaultValue
|
2022-02-22 22:52:50 +01:00
|
|
|
}
|
2022-02-24 22:10:07 +01:00
|
|
|
return val
|
2022-02-22 22:52:50 +01:00
|
|
|
}
|