mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Add events on load (#2451)
This commit is contained in:
parent
e392bebc40
commit
d8a0dc3b4d
4 changed files with 39 additions and 32 deletions
|
@ -87,3 +87,17 @@ export const importFromLocalStorage = () => {
|
|||
}
|
||||
return { elements, appState };
|
||||
};
|
||||
|
||||
export const getTotalStorageSize = () => {
|
||||
const appState = localStorage.getItem(STORAGE_KEYS.LOCAL_STORAGE_APP_STATE);
|
||||
const collab = localStorage.getItem(STORAGE_KEYS.LOCAL_STORAGE_COLLAB);
|
||||
const elements = localStorage.getItem(STORAGE_KEYS.LOCAL_STORAGE_ELEMENTS);
|
||||
const library = localStorage.getItem(STORAGE_KEYS.LOCAL_STORAGE_LIBRARY);
|
||||
|
||||
const appStateSize = appState ? JSON.stringify(appState).length : 0;
|
||||
const collabSize = collab ? JSON.stringify(collab).length : 0;
|
||||
const elementsSize = elements ? JSON.stringify(elements).length : 0;
|
||||
const librarySize = library ? JSON.stringify(library).length : 0;
|
||||
|
||||
return appStateSize + collabSize + elementsSize + librarySize;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue