aboutsummaryrefslogtreecommitdiff
path: root/src/components/hooks/useModified.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/hooks/useModified.ts')
-rw-r--r--src/components/hooks/useModified.ts13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/components/hooks/useModified.ts b/src/components/hooks/useModified.ts
new file mode 100644
index 0000000..ea88888
--- /dev/null
+++ b/src/components/hooks/useModified.ts
@@ -0,0 +1,13 @@
+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 };
+}