doPreparation() — astro Function Reference
Architecture documentation for the doPreparation() function in events.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD 574ffb1c_cb40_43b3_2961_9cc3d8a4b81f["doPreparation()"] 75c59a6f_ee5d_6669_2750_97d28d913e90["events.ts"] 574ffb1c_cb40_43b3_2961_9cc3d8a4b81f -->|defined in| 75c59a6f_ee5d_6669_2750_97d28d913e90 6587ba97_2146_3a63_576c_6b4a06779bd1["triggerEvent()"] 574ffb1c_cb40_43b3_2961_9cc3d8a4b81f -->|calls| 6587ba97_2146_3a63_576c_6b4a06779bd1 15ebcfcc_16b5_91ba_024c_eb33bed45c84["updateScrollPosition()"] 574ffb1c_cb40_43b3_2961_9cc3d8a4b81f -->|calls| 15ebcfcc_16b5_91ba_024c_eb33bed45c84 style 574ffb1c_cb40_43b3_2961_9cc3d8a4b81f fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/astro/src/transitions/events.ts lines 150–184
export async function doPreparation(
from: URL,
to: URL,
direction: Direction | string,
navigationType: NavigationTypeString,
sourceElement: Element | undefined,
info: any,
signal: AbortSignal,
formData: FormData | undefined,
defaultLoader: (event: TransitionBeforePreparationEvent) => Promise<void>,
) {
const event = new TransitionBeforePreparationEvent(
from,
to,
direction,
navigationType,
sourceElement,
info,
window.document,
signal,
formData,
defaultLoader,
);
if (document.dispatchEvent(event)) {
await event.loader();
if (!event.defaultPrevented) {
triggerEvent(TRANSITION_AFTER_PREPARATION);
if (event.navigationType !== 'traverse') {
// save the current scroll position before we change the DOM and transition to the new page
updateScrollPosition({ scrollX, scrollY });
}
}
}
return event;
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does doPreparation() do?
doPreparation() is a function in the astro codebase, defined in packages/astro/src/transitions/events.ts.
Where is doPreparation() defined?
doPreparation() is defined in packages/astro/src/transitions/events.ts at line 150.
What does doPreparation() call?
doPreparation() calls 2 function(s): triggerEvent, updateScrollPosition.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free