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);
|
||||
}
|
||||
Reference in new issue
Block a user