譬如：处理 DOM 事件、重置尺寸、卷动、渲染、CSS 动画等。
of 60 fps (frames per second) for a 60 Hz refresh rate is a common target for a good
user experience. This means the browser should process a frame in about 16.7 ms.
An application can register a
performance entry types
(callback) will be notified when new "
" events are added to the browser's
and the frame's
(length of time) will be available. This data can be used to help identify areas that take too long to provide a good user experience.
Example code of the interfaces described in this document is included in 使用帧计时 API .
DOMHighResTimeStampwhen the frame was started.
timestampindicating the difference between the
startTimes of two successive frames.
This data, particularly the
timestamp, can be used to help identify performance problems.
interfaces allow an application to register an
performance event types
. When one of those event types is recorded in the browser's
, the application is notified of the event via the observer's callback function that was specified when the observer was created.
To observe "
" performance entry types, the application first creates a
object with a specific frame observer callback (function). Next,
is used to specify the set of performance events to observe - in this case, just the "
" event type. When the browser adds a new frame to the performance timeline, the specified observer callback will be invoked.
When a frame
is invoked, frame
can be retrieved by calling
with an argument of "
". This method returns a list of "
objects. Each frame object's
property returns the timestamp of two consecutive frames. If this value is greater than the time needed to provide a good user experience, further analysis might be warranted.