Skip to content

Commit

Permalink
Merge branch 'main' into feature/svg-animations
Browse files Browse the repository at this point in the history
  • Loading branch information
martrapp authored Oct 30, 2024
2 parents 1551a68 + d8b18b2 commit af44dea
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
5 changes: 2 additions & 3 deletions src/dom-view-transisions-level2.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ declare global {
}

type UpdateCallback = undefined | (() => void | Promise<void>);
type StartViewTransitionParameter
= UpdateCallback | { types?: string[]; update: UpdateCallback };
type StartViewTransitionParameter = UpdateCallback | { types?: string[]; update: UpdateCallback };

interface Document {
startViewTransition(param: StartViewTransitionParameter): ViewTransition;
startViewTransition(param: StartViewTransitionParameter): ViewTransition;
}
interface PageRevealEvent extends Event {
viewTransition: ViewTransition;
Expand Down
14 changes: 4 additions & 10 deletions src/vanilla.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,11 @@ function init() {
self.crossingStorage = crossing.fun;
}

document.addEventListener('astro:after-preparation', () => {
pageSwap();
});
document.addEventListener('astro:after-swap', () => {
pageReveal();
});
document.addEventListener('astro:after-preparation', pageSwap);
document.addEventListener('astro:after-swap', pageReveal);

self.addEventListener('onpageswap' in self ? 'pageswap' : 'pagehide', pageSwap, { once: true });
self.addEventListener('onpagereveal' in self ? 'pagereveal' : 'DOMContentLoaded', pageReveal, {
once: true,
});
self.addEventListener('onpageswap' in self ? 'pageswap' : 'pagehide', pageSwap);
self.addEventListener('onpagereveal' in self ? 'pagereveal' : 'DOMContentLoaded', pageReveal);
}

function pageSwap() {
Expand Down

0 comments on commit af44dea

Please sign in to comment.