aboutsummaryrefslogtreecommitdiffstats
path: root/src/Storage.ts
diff options
context:
space:
mode:
authorMaksymilian Jopek <maks@jopek.eu>2022-06-01 18:53:40 +0200
committerMaksymilian Jopek <maks@jopek.eu>2022-06-01 18:53:40 +0200
commit7a494b148dd03d6346a63641fc479015e7450a26 (patch)
tree08cffc645937617a8d39f456fa4bad04dd80af74 /src/Storage.ts
parent5413001f654d4ea27129cf2edfc15322f2ba27ec (diff)
download1942-7a494b148dd03d6346a63641fc479015e7450a26.tar.gz
1942-7a494b148dd03d6346a63641fc479015e7450a26.tar.zst
1942-7a494b148dd03d6346a63641fc479015e7450a26.zip
Startscreen adn sfx
Diffstat (limited to 'src/Storage.ts')
-rw-r--r--src/Storage.ts6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Storage.ts b/src/Storage.ts
index 632ce50..2307846 100644
--- a/src/Storage.ts
+++ b/src/Storage.ts
@@ -4,7 +4,7 @@ export interface Score {
score: string;
world: string;
}
-export type Storage = Score[]
+export type Storage = Score[];
export function getStorage(): Storage {
const s = JSON.parse(localStorage.getItem("storage") ?? "{}");
const storage = [
@@ -23,6 +23,10 @@ export function setStorage(s: Storage) {
localStorage.setItem("storage", JSON.stringify(s))
}
+export function getHighscore() {
+ return getStorage()[0].score;
+}
+
export function getPlace(s: number): string {
const storage = getStorage();
let place = 7