update at 2026-02-10 14:10:20

This commit is contained in:
douboer
2026-02-10 14:10:20 +08:00
parent b6742cb13a
commit b43155dd0f
9 changed files with 579 additions and 58 deletions

View File

@@ -1,6 +1,7 @@
const STORAGE_KEYS = {
APP_STATE: 'font2svg:app-state',
FAVORITES: 'font2svg:favorites',
ROUTE_STATE: 'font2svg:route-state',
}
function getStorage(key, fallbackValue) {
@@ -49,6 +50,21 @@ function saveFavorites(favorites) {
return unique
}
function loadRouteState() {
return getStorage(STORAGE_KEYS.ROUTE_STATE, {})
}
function saveRouteState(partialState) {
const current = loadRouteState()
const next = {
...current,
...partialState,
updatedAt: Date.now(),
}
setStorage(STORAGE_KEYS.ROUTE_STATE, next)
return next
}
module.exports = {
STORAGE_KEYS,
getStorage,
@@ -57,4 +73,6 @@ module.exports = {
saveAppState,
loadFavorites,
saveFavorites,
loadRouteState,
saveRouteState,
}