mirror of
https://gitlab.com/lecarore/breakout71.git
synced 2025-04-25 14:36:15 -04:00
Build 29085904
This commit is contained in:
parent
de485e5598
commit
f1cd138071
8 changed files with 22 additions and 9 deletions
|
@ -1,5 +1,5 @@
|
|||
// The version of the cache.
|
||||
const VERSION = "29085898";
|
||||
const VERSION = "29085904";
|
||||
|
||||
// The name of the cache
|
||||
const CACHE_NAME = `breakout-71-${VERSION}`;
|
||||
|
|
|
@ -1 +1 @@
|
|||
"29085898"
|
||||
"29085904"
|
||||
|
|
|
@ -4,6 +4,7 @@ import _appVersion from "./data/version.json";
|
|||
import { generateSaveFileContent } from "./generateSaveFileContent";
|
||||
import { getLevelUnlockCondition, reasonLevelIsLocked } from "./game_utils";
|
||||
import { allLevels } from "./loadGameData";
|
||||
import { toast } from "./toast";
|
||||
|
||||
// The page will be reloaded if any migrations were run
|
||||
let migrationsRun = 0;
|
||||
|
@ -15,6 +16,7 @@ function migrate(name: string, cb: () => void) {
|
|||
localStorage.setItem(name, "" + Date.now());
|
||||
migrationsRun++;
|
||||
} catch (e) {
|
||||
toast((e as Error).message);
|
||||
console.warn("Migration " + name + " failed : ", e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,12 +3,17 @@
|
|||
import { toast } from "./toast";
|
||||
|
||||
let cachedSettings: { [key: string]: unknown } = {};
|
||||
let warnedUserAboutLSIssue = false;
|
||||
|
||||
try {
|
||||
for (let key in localStorage) {
|
||||
try {
|
||||
cachedSettings[key] = JSON.parse(localStorage.getItem(key) || "null");
|
||||
} catch (e) {
|
||||
if (!warnedUserAboutLSIssue) {
|
||||
warnedUserAboutLSIssue = true;
|
||||
toast(`Storage issue : ${(e as Error)?.message}`);
|
||||
}
|
||||
console.warn(e);
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +33,6 @@ export function setSettingValue<T>(key: string, value: T) {
|
|||
cachedSettings[key] = value;
|
||||
}
|
||||
|
||||
let warnedUserAboutLSIssue = false;
|
||||
export function commitSettingsChangesToLocalStorage() {
|
||||
try {
|
||||
for (let key of needsSaving) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue