Skip to content
HomePagesHomePages template kit

settleCapture

The whole capture settle, for every surface that shoots a page: the CLI's screenshot and print-preview routes and the render worker.

The whole capture settle, for every surface that shoots a page: the CLI’s screenshot and print-preview routes and the render worker. One function rather than a recipe each host retypes, because the legs and their ORDER are the contract — a surface that waits differently flattens different pixels than the artifact its preview promised.

Every page gets, in order:

  1. hydration complete — island pages only. The host’s readiness promise, FIRST, before the font/decode pass below: an island’s DOM does not exist until it mounts, so a decode pass run before hydration measures a document the artifact will not contain, and every image an island renders would go unwaited.
  2. fonts, images, rAF — the standing readiness pair, over the (hydrated) DOM.
  3. network quiescence — host-observed, for whatever the page is still fetching: an island’s tiles and glyph ranges, or a stylesheet’s own off-origin refs, which no other leg waits for (a background-image is in no decode pass). Unconditional, because the egress contract — a FAILED external request fails the job — is only sound once nothing is still in flight. It is a wait for activity to stop, not a proof that what arrived is painted, and it detects nothing about a decoded image failing to raster — that class is contention between browsers over one machine, and no amount of settling reaches it.
  4. animations landed — every finite animation fast-forwarded to its end state. Unconditional, and AFTER quiescence: a reveal fires at hydration, but a load reveal is pure CSS and an island-free page has them too. This is the leg that decides what a scroll-driven reveal contributes to the artifact, together with {@link CAPTURE_IN_VIEW_SCRIPT}, which is what made it fire at all.
  5. paint grace + rAF flush — an island engine’s own fades, then the tick that puts them on screen. An island-free page has no engine to fade and takes only the flush. The grace stays a constant beat because a canvas engine’s fades are its own, painted outside the animation timeline leg 4 can reach.

Legs 1 and 3 are bounded by {@link CAPTURE_ISLAND_SETTLE_TIMEOUT_MS} and fail naming themselves.

Import from @homepages/template-kit.

function settleCapture(host: CaptureSettleHost): Promise<void>
Name Type Required Description
host CaptureSettleHost required

Promise<void>