aboutsummaryrefslogtreecommitdiff
path: root/src/stores/anime.ts
diff options
context:
space:
mode:
authorFuwn <[email protected]>2023-08-27 17:22:40 -0700
committerFuwn <[email protected]>2023-08-27 17:22:40 -0700
commit7fc05993446392f5342815734a7a2e99cf63bddb (patch)
treefb14a5ab35b6e4fdbcfb83ec18ad3ca594269134 /src/stores/anime.ts
parentfeat(layout): cache user identity (diff)
downloaddue.moe-7fc05993446392f5342815734a7a2e99cf63bddb.tar.xz
due.moe-7fc05993446392f5342815734a7a2e99cf63bddb.zip
feat: cache media
Diffstat (limited to 'src/stores/anime.ts')
-rw-r--r--src/stores/anime.ts12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/stores/anime.ts b/src/stores/anime.ts
new file mode 100644
index 00000000..f269d8d0
--- /dev/null
+++ b/src/stores/anime.ts
@@ -0,0 +1,12 @@
+import { browser } from '$app/environment';
+import { writable } from 'svelte/store';
+
+const anime = writable<string>(browser ? localStorage.getItem('anime') ?? '' : '');
+
+anime.subscribe((value) => {
+ if (browser) {
+ localStorage.setItem('anime', value);
+ }
+});
+
+export default anime;