pinned / client /localStorage.ts
igorktech's picture
Pinned demo: two recorded boards, agent off
6f91ce5 verified
Raw History Blame Contribute Delete
534 Bytes
/**
* Safe localStorage helpers that handle cases where localStorage is not available
* or access is restricted by the browser.
*/
export function getLocalStorageItem(key: string): string | null {
try {
return localStorage.getItem(key)
} catch (error) {
console.warn('Failed to access localStorage:', error)
return null
}
}
export function setLocalStorageItem(key: string, value: string): void {
try {
localStorage.setItem(key, value)
} catch (error) {
console.warn('Failed to set localStorage item:', error)
}
}