mirror of
https://github.com/comatory/fb2iCal
synced 2025-06-05 22:09:25 +02:00
improvement: add record migration and correct state normalization in new code
This commit is contained in:
@ -1,9 +1,12 @@
|
||||
import { writable } from 'svelte/store'
|
||||
|
||||
import { STORAGE_KEYS } from '../services/storageListener'
|
||||
import { migrateRecord, sortRecords } from '../../static/app/storage'
|
||||
|
||||
const createEventStore = () => {
|
||||
const state = JSON.parse(localStorage.getItem(STORAGE_KEYS.EVENTS) || '[]')
|
||||
.map(migrateRecord)
|
||||
.sort(sortRecord)
|
||||
|
||||
const { subscribe, set, update } = writable(state)
|
||||
|
||||
|
Reference in New Issue
Block a user