15 lines
397 B
TypeScript
15 lines
397 B
TypeScript
import { PREF } from "./const";
|
|
|
|
export function setPlayerAnswers(answers: string[]) {
|
|
localStorage.setItem(PREF.worthy_words, JSON.stringify(answers));
|
|
window.dispatchEvent(new Event('storage'));
|
|
}
|
|
|
|
export function getAnswers(): string[] {
|
|
const answers = localStorage.getItem(PREF.worthy_words);
|
|
if (answers === null) {
|
|
return [];
|
|
}
|
|
return JSON.parse(answers);
|
|
}
|