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 11const VERSION = 1 ; // In case we ever need to invalidate these
2- const cache = { } ;
32export function updatePreferences ( prefs , appId , className ) {
43 try {
54 localStorage . setItem ( path ( appId , className ) , JSON . stringify ( prefs ) ) ;
65 } catch {
76 // Fails in Safari private browsing
87 }
9- cache [ appId ] = cache [ appId ] || { } ;
10- cache [ appId ] [ className ] = prefs ;
118}
129
1310export function getPreferences ( appId , className ) {
14- if ( cache [ appId ] && cache [ appId ] [ className ] ) {
15- return cache [ appId ] [ className ] ;
16- }
1711 let entry ;
1812 try {
1913 entry =
@@ -29,10 +23,7 @@ export function getPreferences(appId, className) {
2923 return null ;
3024 }
3125 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 ) ;
3627 } catch {
3728 return null ;
3829 }
You can’t perform that action at this time.
0 commit comments