Skip to content

Commit

Permalink
Add View Transitions
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniils Petrovs committed Jun 23, 2024
1 parent 7db2b37 commit f43128c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/routes/+layout.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script lang="ts">
import '../app.css';
import { onNavigate } from '$app/navigation';
import { setToast, toastStore } from '$lib/stores/toasts';
import { userToken } from '$lib/stores/userinfo';
Expand All @@ -20,10 +21,21 @@
Object.assign(window, {
setToast: setToast,
saveStamp: saveStamp,
collectedStamps: collectedStamps,
collectedStamps: collectedStamps
});
}
});
onNavigate((navigation) => {
if (!document.startViewTransition) return;
return new Promise((resolve) => {
document.startViewTransition(async () => {
resolve();
await navigation.complete;
});
});
});
</script>

<Navigation>
Expand Down

0 comments on commit f43128c

Please sign in to comment.