Better listening for path changes

This commit is contained in:
Gregory Schier
2023-10-28 23:41:24 -07:00
parent c2c3a28aab
commit 899092b4d2
5 changed files with 37 additions and 28 deletions

View File

@@ -36,7 +36,7 @@ export async function getKeyValue<T>({
return extractKeyValueOrFallback(kv, fallback);
}
export function extractKeyValue<T>(kv: KeyValue | null): T | undefined {
function extractKeyValue<T>(kv: KeyValue | null): T | undefined {
if (kv === null) return undefined;
try {
return JSON.parse(kv.value) as T;
@@ -45,7 +45,7 @@ export function extractKeyValue<T>(kv: KeyValue | null): T | undefined {
}
}
export function extractKeyValueOrFallback<T>(kv: KeyValue | null, fallback: T): T {
function extractKeyValueOrFallback<T>(kv: KeyValue | null, fallback: T): T {
const v = extractKeyValue<T>(kv);
if (v === undefined) return fallback;
return v;