Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
techniq committed Aug 15, 2023
1 parent 3a3cf0b commit 0cdabbe
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/lib/stores/localStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ import { expireObject } from '../utils/object';
import type { Expiry } from '../utils/object';
import { browser } from '../utils/env';

// https://stackoverflow.com/questions/56488202/how-to-persist-svelte-store
// https://github.com/joshnuss/svelte-local-storage-store/blob/master/src/index.js
// https://github.com/andsala/svelte-persistent-store/blob/master/src/generator.ts
// https://github.com/sbcs-chh/app-finance/blob/develop/Finance.Web/ClientApp/src/hooks/LocalStorage.tsx
// https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Svelte_stores#implementing_our_custom_todos_store

type LocalStoreOptions<Value> = {
expiry?: Expiry | ((previousExpiry: Expiry | undefined | null) => Expiry);
override?: Value;
Expand All @@ -28,9 +22,8 @@ function localStore<Value>(key: string, initialValue: Value, options?: LocalStor
if (storedValue !== null) {
const decodedValue = parse(storedValue);
if (options?.expiry) {
// TODO: if object returned, merge with initialValue (sub-properties)?
// TODO: If object returned, merge with initialValue (sub-properties)?
value = expireObject<Value>(decodedValue.value, decodedValue.expiry) ?? initialValue;

previousExpiry = decodedValue.expiry;
} else {
value = decodedValue;
Expand Down

1 comment on commit 0cdabbe

@vercel
Copy link

@vercel vercel bot commented on 0cdabbe Aug 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.