svelte-ux
Version:
- Increment version in `package.json` and commit as `Version bump to x.y.z` - `npm run publish`
14 lines (13 loc) • 584 B
TypeScript
/**
* Store to wrap `Map` to simplify syncing state (set, delete, clear) with Svelte
*/
export default function mapStore<TKey, TValue>(initialValues?: ConstructorParameters<typeof Map<TKey, TValue>>[0]): {
subscribe: (this: void, run: import("svelte/store").Subscriber<Map<TKey, TValue>>, invalidate?: (value?: Map<TKey, TValue>) => void) => import("svelte/store").Unsubscriber;
set(key: TKey, value: TValue): void;
delete(key: TKey): void;
clear(): void;
/**
* Force a reactive update in case of internal changes to entries
*/
refresh(): void;
};