RiddleHintPage
This commit is contained in:
1 parent
4a6a9595d4
commit
662d8023bb
18 files changed
+212
-17
No files matched your search
@@ -0,0 +1,19 @@
|
||||
import { PREF } from "./const";
|
||||
|
||||
export function addBoughtHint(id: number) {
|
||||
const hints = getBoughtHints();
|
||||
if (hints.includes(id)) {
|
||||
return;
|
||||
}
|
||||
hints.push(id)
|
||||
localStorage.setItem(PREF.boughtHints, JSON.stringify(hints));
|
||||
window.dispatchEvent(new Event('storage'));
|
||||
}
|
||||
|
||||
export function getBoughtHints(): number[] {
|
||||
const hintsList = localStorage.getItem(PREF.boughtHints);
|
||||
if (hintsList === null) {
|
||||
return [];
|
||||
}
|
||||
return JSON.parse(hintsList);
|
||||
}
|
||||
+2
-1
@@ -7,5 +7,6 @@ export enum PREF {
|
||||
playerCount = "PREF_PLAYER_COUNT",
|
||||
worthyWords = "PREF_WORTHY_ANSWERS",
|
||||
readerState = "PREF_LAST_READER_STATE",
|
||||
voiceover = "PREF_VOICEOVER_STATE"
|
||||
voiceover = "PREF_VOICEOVER_STATE",
|
||||
boughtHints = "PREF_BOUGHT_HINTS"
|
||||
};
|
||||
+1
-1
@@ -8,7 +8,7 @@ function setPoints(points: string) {
|
||||
window.dispatchEvent(new Event('storage'));
|
||||
}
|
||||
|
||||
function getPoints(): number {
|
||||
export function getPoints(): number {
|
||||
const points = localStorage.getItem(PREF.points);
|
||||
if (points === null) {
|
||||
return 0;
|
||||
|
||||
Reference in new issue
Block a user