File tree Expand file tree Collapse file tree 1 file changed +1
-10
lines changed Expand file tree Collapse file tree 1 file changed +1
-10
lines changed Original file line number Diff line number Diff line change 1
1
const VERSION = 1 ; // In case we ever need to invalidate these
2
- const cache = { } ;
3
2
export function updatePreferences ( prefs , appId , className ) {
4
3
try {
5
4
localStorage . setItem ( path ( appId , className ) , JSON . stringify ( prefs ) ) ;
6
5
} catch {
7
6
// Fails in Safari private browsing
8
7
}
9
- cache [ appId ] = cache [ appId ] || { } ;
10
- cache [ appId ] [ className ] = prefs ;
11
8
}
12
9
13
10
export function getPreferences ( appId , className ) {
14
- if ( cache [ appId ] && cache [ appId ] [ className ] ) {
15
- return cache [ appId ] [ className ] ;
16
- }
17
11
let entry ;
18
12
try {
19
13
entry =
@@ -29,10 +23,7 @@ export function getPreferences(appId, className) {
29
23
return null ;
30
24
}
31
25
try {
32
- const prefs = JSON . parse ( entry ) ;
33
- cache [ appId ] = cache [ appId ] || { } ;
34
- cache [ appId ] [ className ] = prefs ;
35
- return prefs ;
26
+ return JSON . parse ( entry ) ;
36
27
} catch {
37
28
return null ;
38
29
}
You can’t perform that action at this time.
0 commit comments