(key: string, ifNotPresent: T)
| 67 | |
| 68 | class SessionThenLocalStorage implements Storage { |
| 69 | get<T>(key: string, ifNotPresent: T): string | T { |
| 70 | try { |
| 71 | const sessionValue = window.sessionStorage.getItem(prefix + key); |
| 72 | if (sessionValue !== null) return sessionValue; |
| 73 | } catch { |
| 74 | // Swallow up any security exceptions... |
| 75 | } |
| 76 | return localStorage.get<T>(key, ifNotPresent); |
| 77 | } |
| 78 | |
| 79 | remove(key: string) { |
| 80 | this.removeSession(key); |