1((wp, drupalSettings) => { 2 const userId = drupalSettings.user ? drupalSettings.user.uid || 1 : 1; 3 const storageKey = `WP_PREFERENCES_USER_${userId}`; 4 const { preferences, preferencesPersistence } = wp; 5 6 const getUserPreferences = () => { 7 const persisted = localStorage.getItem(storageKey); 8 if (persisted !== null) { 9 try { 10 return JSON.parse( persisted ); 11 } catch ( error ) {} 12 } 13 return {}; 14 } 15 16 const serverData = getUserPreferences(); 17 const persistenceLayer = preferencesPersistence.__unstableCreatePersistenceLayer( serverData, userId ); 18 const preferencesStore = preferences.store; 19 wp.data.dispatch( preferencesStore ).setPersistenceLayer( persistenceLayer ); 20})(wp, drupalSettings);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.