阶段七:完成 React Feature 化与前置重构收口
This commit is contained in:
1 parent
375e84d663
commit
1a228dc35c
305 files changed
+14179
-5431
No files matched your search
@@ -0,0 +1,21 @@
|
||||
// storageKey 侧边栏折叠状态存储键。
|
||||
const storageKey = 'ydisks.sidebar.v1';
|
||||
|
||||
// readSidebarCollapsed 读取侧边栏折叠状态。
|
||||
export const readSidebarCollapsed = (): boolean => {
|
||||
try {
|
||||
return window.localStorage.getItem(storageKey) === 'collapsed';
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
// writeSidebarCollapsed 写入侧边栏折叠状态。
|
||||
export const writeSidebarCollapsed = (collapsed: boolean): void => {
|
||||
try {
|
||||
window.localStorage.setItem(storageKey, collapsed ? 'collapsed' : 'expanded');
|
||||
} catch {
|
||||
// Storage can be unavailable in hardened browsers; the in-memory state
|
||||
// remains fully functional.
|
||||
}
|
||||
};
|
||||
Reference in new issue
Block a user