aboutsummaryrefslogtreecommitdiff
path: root/src/stores
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
parentfeat(layout): cache user identity (diff)
downloaddue.moe-7fc05993446392f5342815734a7a2e99cf63bddb.tar.xz
due.moe-7fc05993446392f5342815734a7a2e99cf63bddb.zip
feat: cache media
Diffstat (limited to 'src/stores')
-rw-r--r--src/stores/anime.ts12
-rw-r--r--src/stores/animeLastPrune.ts14
-rw-r--r--src/stores/cacheMinutes.ts14
-rw-r--r--src/stores/lastPruneAt.ts12
-rw-r--r--src/stores/manga.ts12
-rw-r--r--src/stores/mangaLastPrune.ts14
6 files changed, 66 insertions, 12 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;
diff --git a/src/stores/animeLastPrune.ts b/src/stores/animeLastPrune.ts
new file mode 100644
index 00000000..f2e747d1
--- /dev/null
+++ b/src/stores/animeLastPrune.ts
@@ -0,0 +1,14 @@
+import { browser } from '$app/environment';
+import { writable } from 'svelte/store';
+
+const animeLastPrune = writable<string>(
+ browser ? localStorage.getItem('animeLastPrune') ?? '' : ''
+);
+
+animeLastPrune.subscribe((value) => {
+ if (browser) {
+ localStorage.setItem('animeLastPrune', value);
+ }
+});
+
+export default animeLastPrune;
diff --git a/src/stores/cacheMinutes.ts b/src/stores/cacheMinutes.ts
new file mode 100644
index 00000000..ccea5db1
--- /dev/null
+++ b/src/stores/cacheMinutes.ts
@@ -0,0 +1,14 @@
+import { browser } from '$app/environment';
+import { writable } from 'svelte/store';
+
+const cacheMinutes = writable<string>(
+ browser ? localStorage.getItem('cacheMinutes') ?? '30' : '30'
+);
+
+cacheMinutes.subscribe((value) => {
+ if (browser) {
+ localStorage.setItem('cacheMinutes', value);
+ }
+});
+
+export default cacheMinutes;
diff --git a/src/stores/lastPruneAt.ts b/src/stores/lastPruneAt.ts
deleted file mode 100644
index 0720bc60..00000000
--- a/src/stores/lastPruneAt.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-import { browser } from '$app/environment';
-import { writable } from 'svelte/store';
-
-const lastPruneAt = writable<string>(browser ? localStorage.getItem('lastPruneAt') ?? '' : '');
-
-lastPruneAt.subscribe((value) => {
- if (browser) {
- localStorage.setItem('lastPruneAt', value);
- }
-});
-
-export default lastPruneAt;
diff --git a/src/stores/manga.ts b/src/stores/manga.ts
new file mode 100644
index 00000000..74e3f95a
--- /dev/null
+++ b/src/stores/manga.ts
@@ -0,0 +1,12 @@
+import { browser } from '$app/environment';
+import { writable } from 'svelte/store';
+
+const manga = writable<string>(browser ? localStorage.getItem('manga') ?? '' : '');
+
+manga.subscribe((value) => {
+ if (browser) {
+ localStorage.setItem('manga', value);
+ }
+});
+
+export default manga;
diff --git a/src/stores/mangaLastPrune.ts b/src/stores/mangaLastPrune.ts
new file mode 100644
index 00000000..f6b40b02
--- /dev/null
+++ b/src/stores/mangaLastPrune.ts
@@ -0,0 +1,14 @@
+import { browser } from '$app/environment';
+import { writable } from 'svelte/store';
+
+const mangaLastPrune = writable<string>(
+ browser ? localStorage.getItem('mangaLastPrune') ?? '' : ''
+);
+
+mangaLastPrune.subscribe((value) => {
+ if (browser) {
+ localStorage.setItem('mangaLastPrune', value);
+ }
+});
+
+export default mangaLastPrune;