Add desktop games, robot pet and TCG app
This commit is contained in:
1 parent
812503251b
commit
c664f573b8
55 files changed
+5090
-15
No files matched your search
@@ -0,0 +1,19 @@
|
||||
function storageKey(gameName: string): string {
|
||||
return `${gameName}-high-score`;
|
||||
}
|
||||
|
||||
export function loadHighScore(gameName: string): number {
|
||||
try {
|
||||
return Number(localStorage.getItem(storageKey(gameName))) || 0;
|
||||
} catch {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
export function saveHighScore(gameName: string, score: number) {
|
||||
try {
|
||||
localStorage.setItem(storageKey(gameName), String(score));
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user