()
| 10 | const fallbackStorage = new Map<string, string>(); |
| 11 | |
| 12 | const readStorage = (): Pick<Storage, 'getItem' | 'setItem' | 'removeItem'> => { |
| 13 | try { |
| 14 | if (typeof window !== 'undefined' && window.sessionStorage) { |
| 15 | return window.sessionStorage; |
| 16 | } |
| 17 | } catch { |
| 18 | // Fall through to the in-memory store. |
| 19 | } |
| 20 | |
| 21 | return { |
| 22 | getItem: (key) => fallbackStorage.get(key) ?? null, |
| 23 | setItem: (key, value) => { |
| 24 | fallbackStorage.set(key, value); |
| 25 | }, |
| 26 | removeItem: (key) => { |
| 27 | fallbackStorage.delete(key); |
| 28 | }, |
| 29 | }; |
| 30 | }; |
| 31 | |
| 32 | const getStorageKey = (roomId: string): string => |
| 33 | `${storageKeyPrefix}${roomId}`; |
no outgoing calls
no test coverage detected