Skip to content
HomePagesHomePages template kit

CAPTURE_READY_EXPRESSION

The in-page expression a capturer awaits after {@link CAPTURE_WAIT_UNTIL} before shooting.

The in-page expression a capturer awaits after {@link CAPTURE_WAIT_UNTIL} before shooting. The load event is not the settle point: web fonts may still swap in after it, and an image whose bytes have arrived may still be decoding — a capture taken mid-swap is a layout the shell never showed a user, and one taken mid-decode ships a blank or half-painted region. So, in order: fonts settled, every image un-deferred, then a decode of every <img> on the page, then one requestAnimationFrame tick to flush the layout those swaps produced.

The un-deferring step is load-bearing, not tidying. A capturer opens ONE viewport over a document that is routinely taller than it: a frame shell clips at the format’s box, and a print document stacks every page into one window. A browser never starts a loading="lazy" image outside that viewport, and a decode of an image whose fetch was never started never settles — so a single lazy image below the fold hangs the capture forever instead of shooting it. Image primitives default to lazy (it is the right default for a published page), which puts every clipped or off-page photo in that state. Promoting them to eager first makes the wait total and terminating; the capture page is discarded after the shot, so the mutation costs nothing and is invisible to the artifact.

A decode that fails rejects the whole expression and so fails the capture — a broken image is a defect to surface, not a hole to ship — and the message names the offending URL. Every capture surface awaits this one string (CLI screenshot, print preview, View live, check, the render worker), so the playground preview cannot drift from the shipped artifact.

This readiness pair is one leg of the settle, not the whole of it: every page also waits out network quiescence afterwards, and a page that ships islands hydrates before it and gets a paint-grace beat after; see {@link settleCapture} for the order.

Typed string, not the inferred literal: the expression is a program, and its literal type would put the whole escaped source in every signature that names it — including the kit’s generated reference page — while telling a consumer nothing the prose above does not. Nothing may branch on its text.

Import from @homepages/template-kit.

const CAPTURE_READY_EXPRESSION: string