diff options
| author | Fuwn <[email protected]> | 2024-04-01 17:33:05 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-04-01 17:33:05 -0700 |
| commit | f4d25ee1275d4783933ec173a5bc60b99181d855 (patch) | |
| tree | b1e9bc225cef7b12dc70c1de91e5e189e9060787 /src/stores/announcementHash.ts | |
| parent | feat(sequelspy): show days instead of weeks for long (diff) | |
| download | due.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.ts | 12 |
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; |