* Safely removes an item from localStorage * @param key - The storage key to remove * @returns True if successful, false otherwise
(key: string)
| 67 | * @returns True if successful, false otherwise |
| 68 | */ |
| 69 | static removeItem(key: string): boolean { |
| 70 | if (typeof window === 'undefined') { |
| 71 | return false |
| 72 | } |
| 73 | |
| 74 | try { |
| 75 | window.localStorage.removeItem(key) |
| 76 | return true |
| 77 | } catch (error) { |
| 78 | logger.warn(`Failed to remove localStorage item "${key}":`, error) |
| 79 | return false |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * Check if localStorage is available |
no test coverage detected