umami/src/components/hooks/useModified.ts
2025-02-13 22:53:25 -08:00

13 lines
277 B
TypeScript

import { create } from 'zustand';
const store = create(() => ({}));
export function touch(key: string) {
store.setState({ [key]: Date.now() });
}
export function useModified(key?: string) {
const modified = store(state => state?.[key]);
return { modified, touch };
}