mirror of
https://github.com/comatory/fb2iCal
synced 2025-06-05 22:09:25 +02:00
feature: sync multiple tabs using local storage
This commit is contained in:
@ -6,24 +6,18 @@ const createConfigStore = () => {
|
||||
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
|
||||
})
|
||||
update((prevState) => ({ ...prevState, [key]: value }))
|
||||
}
|
||||
|
||||
const getState = () => state
|
||||
|
||||
return {
|
||||
...state,
|
||||
subscribe,
|
||||
set,
|
||||
update,
|
||||
setValue,
|
||||
getState,
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user