diff --git a/src/App.svelte b/src/App.svelte
index 5895184..4652ecd 100644
--- a/src/App.svelte
+++ b/src/App.svelte
@@ -8,8 +8,6 @@
import { onDestroy, onMount } from "svelte";
import type { Unsubscriber } from "svelte/store";
- SharkGame.init();
-
let root: HTMLElement;
let unsubscribeSettings: Unsubscriber;
@@ -40,6 +38,10 @@
-
-
-
+{#await SharkGame.initialize()}
+ Loading...
+{:then}
+
+
+
+{/await}
diff --git a/src/shark/SaveHandler.ts b/src/shark/SaveHandler.ts
index b6994ae..216344d 100644
--- a/src/shark/SaveHandler.ts
+++ b/src/shark/SaveHandler.ts
@@ -84,12 +84,14 @@ export class SaveHandler extends StaticClass {
Math.round((encodedSave.length / stringifiedSave.length) * 100 * 100) / 100
}% size`
);
- console.timeEnd("Done saving");
localStorage.setItem(SaveHandler.saveName, encodedSave);
+ console.timeEnd("Done saving");
}
- static async load(game: typeof SharkGame): Promise {
+ static async load(game: typeof SharkGame): Promise {
+ console.debug("Loading");
+ console.time("Done loading");
const localSave = LZString.decompressFromBase64(localStorage.getItem(SaveHandler.saveName));
const loadedSave = JSON.parse(localSave ?? "{}");
const saveVersion = loadedSave.version ?? 0;
@@ -123,8 +125,7 @@ export class SaveHandler extends StaticClass {
game.Log.addMessage(message.content, message.type);
});
game.TabHandler.currentTab = game.TabHandler.AllTabs[fullSave.selectedTab];
-
- return game;
+ console.timeEnd("Done loading");
}
static migrators: ((save: Save) => Save)[] = [
diff --git a/src/shark/Settings.ts b/src/shark/Settings.ts
index c1eae52..c62edd2 100644
--- a/src/shark/Settings.ts
+++ b/src/shark/Settings.ts
@@ -44,7 +44,7 @@ export class Settings extends StaticClass {
default: 1 as const,
name: "Autosave" as const,
description: "How many seconds to wait between each autosave" as const,
- options: ["Off", 1, 5, 15, 60] as const,
+ options: ["Off", 1, 5, 10, 15, 60] as const,
},
},
};
diff --git a/src/shark/SharkGame.ts b/src/shark/SharkGame.ts
index 3206ecc..94cf898 100644
--- a/src/shark/SharkGame.ts
+++ b/src/shark/SharkGame.ts
@@ -67,13 +67,13 @@ export class SharkGame extends StaticClass {
HomeActions,
});
- static init(): void {
- SaveHandler.load(this);
+ static async initialize(): Promise {
+ await SaveHandler.load(this);
+
+ SharkGame.title = SharkGame.#GAME_NAMES[Math.floor(Math.random() * SharkGame.#GAME_NAMES.length)];
Log.init();
SaveHandler.init(this);
-
- SharkGame.title = SharkGame.#GAME_NAMES[Math.floor(Math.random() * SharkGame.#GAME_NAMES.length)];
}
static save(): void {
SaveHandler.save(this);