Add events on load (#2451)

This commit is contained in:
Lipis 2020-12-05 01:18:21 +02:00 committed by GitHub
parent e392bebc40
commit d8a0dc3b4d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 39 additions and 32 deletions

View file

@ -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;
};