Download client/localStorage.ts from igorktech/pinned: direct link, hf CLI and curl.
- Browser
- Download file 534 Bytes
-
https://huggingface.co/spaces/igorktech/pinned/resolve/main/client/localStorage.ts
- Command line
-
hf download hf://spaces/igorktech/pinned/client/localStorage.ts
-
curl -L -o localStorage.ts https://huggingface.co/spaces/igorktech/pinned/resolve/main/client/localStorage.ts
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) | |
| } | |
| } | |