first draft

This commit is contained in:
Jannik Streidl 2024-02-22 11:54:55 +01:00
parent 5fd1acbd99
commit 230f787da1
8 changed files with 149 additions and 6 deletions

View file

@ -32,3 +32,16 @@ export const documents = writable([
export const settings = writable({});
export const showSettings = writable(false);
function createLocalStorageStore(key, startValue) {
const storedValue = localStorage.getItem(key);
const initialValue = storedValue ? JSON.parse(storedValue) : startValue;
const store = writable(initialValue);
store.subscribe((value) => {
localStorage.setItem(key, JSON.stringify(value));
});
return store;
}
export const showWhatsChanged = createLocalStorageStore('showWhatsChanged', true);