mirror of
https://git.coom.tech/fuckjannies/lolipiss.git
synced 2024-06-26 12:42:38 +00:00
21 lines
500 B
TypeScript
21 lines
500 B
TypeScript
import { writable } from "svelte/store";
|
|
|
|
const localLoad = (key: string, def: any) =>
|
|
key in localStorage
|
|
? JSON.parse(localStorage.getItem('__pee__' + key)!)
|
|
: def;
|
|
|
|
const localSet = (key: string, value: any) =>
|
|
localStorage.setItem('__pee__' + key, JSON.stringify(value));
|
|
|
|
export const settings = writable(localLoad('settings', {
|
|
apv: false,
|
|
apa: false,
|
|
blacklist: [],
|
|
sources: []
|
|
}));
|
|
|
|
settings.subscribe(newVal => {
|
|
localSet('settings', newVal);
|
|
});
|