collectPreloads() — astro Function Reference
Architecture documentation for the collectPreloads() function in view-transitions.test.js from the astro codebase.
Entity Profile
Dependency Diagram
graph TD c89f0fdb_aa9d_4981_d062_6713f5d8743e["collectPreloads()"] b4c19437_37d7_2f07_374e_31b46d21464b["view-transitions.test.js"] c89f0fdb_aa9d_4981_d062_6713f5d8743e -->|defined in| b4c19437_37d7_2f07_374e_31b46d21464b style c89f0fdb_aa9d_4981_d062_6713f5d8743e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/astro/e2e/view-transitions.test.js lines 31–43
function collectPreloads(page) {
return page.evaluate(() => {
window.preloads = [];
const observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) =>
mutation.addedNodes.forEach((node) => {
if (node.nodeName === 'LINK' && node.rel === 'preload') preloads.push(node.href);
}),
);
});
observer.observe(document.head, { childList: true });
});
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does collectPreloads() do?
collectPreloads() is a function in the astro codebase, defined in packages/astro/e2e/view-transitions.test.js.
Where is collectPreloads() defined?
collectPreloads() is defined in packages/astro/e2e/view-transitions.test.js at line 31.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free