aboutsummaryrefslogtreecommitdiff
path: root/src/stores/announcementHash.ts
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-04-01 17:33:05 -0700
committerFuwn <[email protected]>2024-04-01 17:33:05 -0700
commitf4d25ee1275d4783933ec173a5bc60b99181d855 (patch)
treeb1e9bc225cef7b12dc70c1de91e5e189e9060787 /src/stores/announcementHash.ts
parentfeat(sequelspy): show days instead of weeks for long (diff)
downloaddue.moe-f4d25ee1275d4783933ec173a5bc60b99181d855.tar.xz
due.moe-f4d25ee1275d4783933ec173a5bc60b99181d855.zip
feat(layout): announcement feature
Diffstat (limited to 'src/stores/announcementHash.ts')
-rw-r--r--src/stores/announcementHash.ts12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/stores/announcementHash.ts b/src/stores/announcementHash.ts
new file mode 100644
index 00000000..4a44d670
--- /dev/null
+++ b/src/stores/announcementHash.ts
@@ -0,0 +1,12 @@
+import { browser } from '$app/environment';
+import { writable } from 'svelte/store';
+
+const announcementHash = writable<number>(
+ browser ? parseInt(localStorage.getItem('announcementHash') || '1') : 0
+);
+
+announcementHash.subscribe((value) => {
+ if (browser) localStorage.setItem('announcementHash', value.toString());
+});
+
+export default announcementHash;