1
0
mirror of https://github.com/comatory/fb2iCal synced 2025-06-05 22:09:25 +02:00

feature: add Svelte framework to app, refactor tracking panel into Svelte component

This commit is contained in:
Ondřej Synáček
2020-12-15 10:23:20 +01:00
parent e3a2ebeaf2
commit a89777b91a
14 changed files with 511 additions and 89 deletions

View File

@@ -0,0 +1,30 @@
import { writable } from 'svelte/store'
const createConfigStore = () => {
const state = JSON.parse(localStorage.getItem('fb-to-ical-config') || '{}')
const { subscribe, set, update } = writable(state)
const setValue = (key, value) => {
update((prevState) => {
const nextState = {
...prevState,
[key]: value,
}
localStorage.setItem('fb-to-ical-config', JSON.stringify(nextState))
return nextState
})
}
return {
...state,
subscribe,
set,
update,
setValue,
}
}
export default createConfigStore()