跳到主要内容

PerformanceTimeline🧪

性能时间线事件的报告,遵循 https://w3c.github.io/performance-timeline/#dom-performanceobserver 中的规范。

EN
Reporting of performance timeline events, as specified in https://w3c.github.io/performance-timeline/#dom-performanceobserver.

✅️️ Methods

🔨PerformanceTimeline.enable

先前缓冲的事件将在方法返回前报告。另请参阅:timelineEventAdded

EN
Previously buffered events would be reported before method returns. See also: timelineEventAdded
参数必填标记类型描述原文
eventTypes✔️array[string]要报告的事件类型,依据https://w3c.github.io/performance-timeline/#dom-performanceentry-entrytype中的规定。指定的筛选条件会覆盖所有先前设置的筛选条件,传递空筛选条件则会禁用记录功能。请注意,目前并非所有在Web平台中公开的类型都受到支持。
ENThe types of event to report, as specified in https://w3c.github.io/performance-timeline/#dom-performanceentry-entrytype The specified filter overrides any previous filters, passing empty filter disables recording. Note that not all types exposed to the web platform are currently supported.

✅️️ Events

👋PerformanceTimeline.timelineEventAdded

当添加性能时间线事件时发送。参见 reportPerformanceTimeline 方法。

EN
Sent when a performance timeline event is added. See reportPerformanceTimeline method.
参数必填标记类型描述原文
event✔️TimelineEvent

✅️️ Types

📌PerformanceTimeline.LargestContentfulPaint

请参阅 https://github.com/WICG/LargestContentfulPaint 和 largest_contentful_paint.idl

EN
See https://github.com/WICG/LargestContentfulPaint and largest_contentful_paint.idl

返回类型:object

属性必填标记类型描述原文
renderTime✔️Network.TimeSinceEpoch
loadTime✔️Network.TimeSinceEpoch
size✔️number正在绘制的像素数量。
ENThe number of pixels being painted.
elementIdstring元素的id属性(如果可用)。
ENThe id attribute of the element, if available.
urlstring图像URL(可能被截断)。
ENThe URL of the image (may be trimmed).
nodeIdDOM.BackendNodeId

📌PerformanceTimeline.LayoutShift

请参阅 https://wicg.github.io/layout-instability/#sec-layout-shift 和 layout_shift.idl

EN

返回类型:object

属性必填标记类型描述原文
value✔️number此事件产生的分数增量。
ENScore increment produced by this event.
hadRecentInput✔️boolean
lastInputTime✔️Network.TimeSinceEpoch
sources✔️array[LayoutShiftAttribution]

📌PerformanceTimeline.LayoutShiftAttribution

返回类型:object

属性必填标记类型描述原文
previousRect✔️DOM.Rect
currentRect✔️DOM.Rect
nodeIdDOM.BackendNodeId

📌PerformanceTimeline.TimelineEvent

返回类型:object

属性必填标记类型描述原文
frameId✔️Page.FrameId标识此事件相关的帧。对于非帧目标则为空。
ENIdentifies the frame that this event is related to. Empty for non-frame targets.
type✔️string事件类型,依据 https://w3c.github.io/performance-timeline/#dom-performanceentry-entrytype 中的定义。它决定了哪些可选的“details”字段会出现。
ENThe event type, as specified in https://w3c.github.io/performance-timeline/#dom-performanceentry-entrytype This determines which of the optional "details" fields is present.
name✔️string名称可能为空,具体取决于类型。
ENName may be empty depending on the type.
time✔️Network.TimeSinceEpoch自Epoch以来的秒数,在文档生命周期内单调递增。
ENTime in seconds since Epoch, monotonically increasing within document lifetime.
durationnumber事件持续时间(如适用)。
ENEvent duration, if applicable.
lcpDetailsLargestContentfulPaint
layoutShiftDetailsLayoutShift