status/gui/dashboard/stores.js
Romein van Buren 353539fbd4
Fix circular dependency
Signed-off-by: Romein van Buren <romein@vburen.nl>
2022-07-11 15:02:27 +02:00

19 lines
411 B
JavaScript

import { get, writable } from 'svelte/store';
function createSettingsStore() {
const s = writable(0);
function updateStorage(val) {
window.localStorage.setItem('statusdash', JSON.stringify(val));
s.set(val);
}
return {
subscribe: s.subscribe,
set: val => updateStorage(val),
update: val => updateStorage({ ...get(s), val }),
};
}
export const settings = createSettingsStore();