MCPcopy
hub / github.com/angular/components / setAppState

Function setAppState

src/dev-app/dev-app/dev-app-state.ts:61–74  ·  view source on GitHub ↗
(newState: DevAppState)

Source from the content-addressed store, hash-verified

59
60/** Saves the state of the dev app apperance in local storage. */
61export function setAppState(newState: DevAppState): void {
62 const currentState = getAppState();
63 const keys = new Set([...Object.keys(currentState), ...Object.keys(newState)]) as Set<
64 keyof DevAppState
65 >;
66
67 // Only write to storage if something actually changed.
68 for (const key of keys) {
69 if (currentState[key] !== newState[key]) {
70 saveToStorage(newState);
71 break;
72 }
73 }
74}
75
76function saveToStorage(value: DevAppState): void {
77 // Needs a try/catch since some browsers throw an error when accessing in incognito.

Callers 10

toggleThemeMethod · 0.90
toggleSystemThemeMethod · 0.90
toggleStrongFocusMethod · 0.90
toggleZonelessMethod · 0.90
toggleAnimationsMethod · 0.90
toggleDensityMethod · 0.90
toggleRippleDisabledMethod · 0.90
toggleDirectionMethod · 0.90
toggleM3Method · 0.90

Calls 2

getAppStateFunction · 0.85
saveToStorageFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…