breakout71/src/generateSaveFileContent.ts

15 lines
483 B
TypeScript
Raw Normal View History

2025-04-06 18:21:53 +02:00
export function generateSaveFileContent() {
2025-04-07 14:08:48 +02:00
const localStorageContent: Record<string, string> = {};
2025-04-06 18:21:53 +02:00
2025-04-07 14:08:48 +02:00
for (let i = 0; i < localStorage.length; i++) {
const key = localStorage.key(i) as string;
// Avoid including recovery info in the recovery info
if (["recovery_data"].includes(key)) continue;
2025-04-19 17:26:45 +02:00
try {
const value = localStorage.getItem(key) as string;
localStorageContent[key] = JSON.parse(value);
} catch (e) {}
2025-04-07 14:08:48 +02:00
}
2025-04-19 17:26:45 +02:00
return localStorageContent;
2025-04-07 14:08:48 +02:00
}