Web Vitals metrics helpers for crater
Dependencies
pub(all) struct ContentReadiness {
lcp_ready : Bool
lcp_time : Double?
critical_resources_loaded : Bool
a11y_ready : Bool
}pub(all) struct LCPCandidate {
element_id : String
element_type : LCPElementType
size : Double
x : Double
y : Double
width : Double
height : Double
resource_loaded : Bool
render_time : Double?
load_time : Double?
}fn LCPCandidate::new(element_id : String, element_type : LCPElementType, x : Double, y : Double, width : Double, height : Double) -> LCPCandidateimpl Show for LCPElementTypepub struct LCPTracker {
candidates : Array[LCPCandidate]
current_lcp : LCPCandidate?
finalized : Bool
viewport_width : Double
viewport_height : Double
}fn LCPTracker::on_element_rendered(self : LCPTracker, element_id : String, render_time : Double) -> Unitfn LCPTracker::on_resource_loaded(self : LCPTracker, element_id : String, load_time : Double) -> Unitpub(all) struct LayoutShift {
impact_fraction : Double
distance_fraction : Double
score : Double
}impl Show for LayoutShiftfn compute_element_shift(before : BoundingRect, after : BoundingRect, viewport : Size[Double]) -> LayoutShiftfn compute_total(before : Array[BoundingRect], after : Array[BoundingRect], viewport : Size[Double]) -> Doublefn[T : LayoutView] extract_lcp_candidates(root : T, viewport_width : Double, viewport_height : Double) -> Array[LCPCandidate]Web Vitals metrics helpers for crater
Dependencies