diff --git a/source b/source index bf4284c3506..fb7e34dd972 100644 --- a/source +++ b/source @@ -2717,6 +2717,21 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
The following terms are defined in Performance Timeline:
+ +PerformanceEntry
and its
+ name
,
+ entryType
,
+ startTime
, and
+ duration
attributes.Set document's visibility state to visibilityState.
Queue a new
+ VisibilityStateEntry
whose
+ visibility state is
+ visibilityState and whose timestamp is
+ the current high resolution time given document's
+ relevant global object.
VisibilityStateEntry
interfaceThe VisibilityStateEntry
interface exposes visibility changes to the document,
+ from the moment the document becomes active.
function wasHiddenBeforeFirstContentfulPaint() {
+ const fcpEntry = performance.getEntriesByName("first-contentful-paint")[0];
+ const visibilityStateEntries = performance.getEntriesByType("visibility-state");
+ return visibilityStateEntries.some(e =>
+ e.startTime < fcpEntry.startTime &&
+ e.name === "hidden");
+}
+ Since hiding a page can cause throttling of rendering and other user-agent + operations, it is common to use visibility changes as an indication that such throttling has + occurred. However, other things could also cause throttling in different browsers, such as + long periods of inactivity.
+ +[Exposed=(Window)]
+interface VisibilityStateEntry : PerformanceEntry {
+ readonly attribute DOMString name; // shadows inherited name
+ readonly attribute DOMString entryType; // shadows inherited entryType
+ readonly attribute DOMHighResTimeStamp startTime; // shadows inherited startTime
+ readonly attribute unsigned long duration; // shadows inherited duration
+};
+
+ The VisibilityStateEntry
has an associated
+ DOMHighResTimeStamp
+ timestamp.
The VisibilityStateEntry
has an associated "visible
" or
+ "hidden
" visibility state.
The name
getter steps are to return
+ this's visibility state.
The entryType
getter steps are to return
+ "visibility-state
".
The startTime
getter steps are to return
+ this's timestamp.
The duration
getter steps are to return
+ zero.
Queue a new
+ VisibilityStateEntry
whose visibility
+ state is document's visibility state and whose timestamp is zero.
Set window's relevant settings object's execution ready flag.