fixed localStorage key

This commit is contained in:
azykov@mail.ru
2026-09-04 14:11:44 +03:00
parent a1c05799dd
commit c4f0fe2a60
+2 -6
View File
@@ -1,19 +1,15 @@
import { defaultGame } from "./prefabs/game";
import { Game, serializeGameToString, deserializeGame, deserializeGameFromString } from '@incgame/engine';
export const saveParams = {
path: 'default',
}
const KEY_GAME = 'incgame';
export function save(game: Game) {
localStorage.setItem(`${saveParams.path}_${KEY_GAME}`, serializeGameToString(game));
localStorage.setItem(KEY_GAME, serializeGameToString(game));
}
export function load(): Game {
try {
const raw = localStorage.getItem(`${saveParams.path}_${KEY_GAME}`);
const raw = localStorage.getItem(KEY_GAME);
if (raw)
return deserializeGameFromString(raw);
} catch (e) {