Debian Codegraph @

src/modules/animatePageOut.ts

raw
1 import type Swup from '../Swup.js';
2 import type { Visit } from './Visit.js';
3
4 /**
5 * Perform the out/leave animation of the current page.
6 * @returns Promise<void>
7 */
8 export const animatePageOut = async function (this: Swup, visit: Visit) {
9 await this.hooks.call('animation:out:start', visit, undefined, () => {
10 this.classes.add('is-changing', 'is-animating', 'is-leaving');
11 });
12
13 await this.hooks.call('animation:out:await', visit, { skip: false }, (visit, { skip }) => {
14 if (skip) return;
15 return this.awaitAnimations({ selector: visit.animation.selector });
16 });
17
18 await this.hooks.call('animation:out:end', visit, undefined);
19 };