summaryrefslogtreecommitdiff
path: root/src/lib/navigation.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/navigation.ts')
-rw-r--r--src/lib/navigation.ts13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/lib/navigation.ts b/src/lib/navigation.ts
new file mode 100644
index 0000000..c759d97
--- /dev/null
+++ b/src/lib/navigation.ts
@@ -0,0 +1,13 @@
+import { derived } from 'svelte/store';
+import { navigating } from '$app/stores';
+
+let timer: ReturnType<typeof setTimeout> = null;
+export const isNavigating = derived(navigating, (newValue, set) => {
+ if (timer) {
+ clearTimeout(timer);
+ }
+ if (newValue) {
+ timer = setTimeout(() => set(true), 500);
+ }
+ set(false);
+});