1
0
mirror of https://github.com/comatory/fb2iCal synced 2025-06-05 22:09:25 +02:00
2020-12-15 21:49:15 +01:00

27 lines
533 B
JavaScript

import { writable } from 'svelte/store'
import { STORAGE_KEYS } from '../services/storageListener'
const createConfigStore = () => {
const state = JSON.parse(localStorage.getItem(STORAGE_KEYS.CONFIG) || '{}')
const { subscribe, set, update } = writable(state)
const setValue = (key, value) => {
update((prevState) => ({ ...prevState, [key]: value }))
}
const getState = () => state
return {
...state,
subscribe,
set,
update,
setValue,
getState,
}
}
export default createConfigStore()