Skip to content

Commit

Permalink
docs: strong types for AppShell scroll-to-top (skeletonlabs#2164)
Browse files Browse the repository at this point in the history
  • Loading branch information
djdembeck authored Oct 21, 2023
1 parent 2710639 commit 760e77e
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,11 @@
<CodeBlock
language="ts"
code={`
import type { AfterNavigate } from '@sveltejs/kit';
import { afterNavigate } from '$app/navigation';
afterNavigate((params: any) => {
const isNewPage: boolean = params.from && params.to && params.from.route.id !== params.to.route.id;
afterNavigate((params: AfterNavigate) => {
const isNewPage: boolean = params.from?.route.id !== params.to?.route.id;
const elemPage = document.querySelector('#page');
if (isNewPage && elemPage !== null) {
elemPage.scrollTop = 0;
Expand Down

0 comments on commit 760e77e

Please sign in to comment.