LocalStorage used bar

This commit is contained in:
space-nuko
2023-05-25 18:12:26 -05:00
parent 220be38a0b
commit 8cc2af6f80
5 changed files with 119 additions and 34 deletions

View File

@@ -75,7 +75,9 @@ export function download(filename: string, text: string, type: string = "text/pl
}, 0);
}
export function getLocalStorageUsed(): number {
export const MAX_LOCAL_STORAGE_MB = 5;
export function getLocalStorageUsedMB(): number {
var total = 0;
for (const x in localStorage) {
// Value is multiplied by 2 due to data being stored in `utf-16` format, which requires twice the space.