Init commit from initial prompt
This commit is contained in:
22
src/lib/checklist.ts
Normal file
22
src/lib/checklist.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
export const CHECKLIST_KEY = 'magikarp-checklist-v1';
|
||||
|
||||
export function loadChecklist(): Set<string> {
|
||||
if (typeof window === 'undefined') return new Set();
|
||||
try {
|
||||
const raw = localStorage.getItem(CHECKLIST_KEY);
|
||||
if (!raw) return new Set();
|
||||
const arr = JSON.parse(raw) as string[];
|
||||
return new Set(arr);
|
||||
} catch {
|
||||
return new Set();
|
||||
}
|
||||
}
|
||||
|
||||
export function saveChecklist(set: Set<string>) {
|
||||
if (typeof window === 'undefined') return;
|
||||
try {
|
||||
localStorage.setItem(CHECKLIST_KEY, JSON.stringify(Array.from(set)));
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user