Add checked store and set data

This commit is contained in:
Jon Staab
2024-11-14 08:33:11 -08:00
parent 2d89c152b1
commit b296067e55
6 changed files with 35 additions and 4 deletions
+11 -1
View File
@@ -1,9 +1,10 @@
import twColors from "tailwindcss/colors"
import {get, derived} from "svelte/store"
import {get, derived, writable} from "svelte/store"
import {nip19} from "nostr-tools"
import type {Maybe} from "@welshman/lib"
import {
ctx,
now,
setContext,
remove,
assoc,
@@ -16,6 +17,7 @@ import {
nthEq,
shuffle,
parseJson,
prop,
} from "@welshman/lib"
import {
getIdFilters,
@@ -259,6 +261,14 @@ export const deriveEventsForUrl = (url: string, filters: Filter[]) =>
),
)
// Last checked timestamps, notifications
export const checked = writable<Record<string, number>>({})
export const deriveChecked = (key: string) => derived(checked, prop(key))
export const setChecked = (key: string, ts = now()) => checked.update(assoc(key, ts))
// Settings
export const SETTINGS = 38489