You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add id and navigationId fields to PerformanceEntry. These are integers, used to uniquely identify timeline entries,
so that they can be referred to in other entries. The initial use case for this is to track navigation-like events within
a page's lifetime. For this, the navigationId field is used, in each entry, to refer to the most recent navigation (or
back-forward-cache restoration, or soft navigation) which had occurred in the page.
---------
Co-authored-by: Marcos Cáceres <marcos@marcosc.com>
Copy file name to clipboardExpand all lines: explainer.md
+16Lines changed: 16 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,10 +55,12 @@ In order to prevent the user agent from storing too much performance data in mem
55
55
This specification defines the `PerformanceEntry` interface, which is used to host performance data of the web application.
56
56
A single `PerformanceEntry` object corresponds to one nugget of information about the performance of the website.
57
57
The entry has the following attributes:
58
+
*`id`: an integer identifying this `PerformanceEntry` object.
58
59
*`name`: a string identifier for the object, also used to filter entries in the `getEntriesByName()` method.
59
60
*`entryType`: a string representing the type of performance data being exposed. It is also used to filter entries in the `getEntriesByType()` method and in the `PerformanceObserver`.
60
61
*`startTime`: a timestamp representing the starting point for the performance data being recorded. The semantics of this attribute depend on the `entryType`.
61
62
*`duration`: a time duration representing the duration of the performance data being recorded. The semantics of this one also depend on the `entryType`.
63
+
*`navigationId`: an integer identifying (by `id`) the `PerformanceEntry` object corresponding to last navigation or navigation-like event that had occurred in the document at the time that this `PerformanceEntry` object was recorded.
62
64
63
65
If these sound abstract, it’s because they are.
64
66
A specification whose goal is to expose new measurements to web developers will define a new interface which extends `PerformanceEntry`.
@@ -150,6 +152,20 @@ For entryTypes with a fixed amount of entries, like Paint Timing, using the poll
150
152
At the same time, the callback is more useful for cases where there is varying amount of entries of the given entryType, like in Resource Timing.
151
153
The web performance monitoring service can process all the performance information while the page is still running and only has to do very minimal work when the data needs to be reported.
152
154
155
+
## Page lifetime issues
156
+
When this API was originally designed, documents had a relatively simple lifecycle: they were
157
+
loaded when the user navigated to them, and unloaded when the user navigated away, with the
158
+
JavaScript environment being torn down at that time. Since then, the sitution has become more
159
+
complex, with many browsers introducing a back-forward cache, with which a user can return to
160
+
a document which they have previously navigated away from. The web has also seen a rise in
161
+
popularity of Single Page Apps, where what appears to the user to be a navigation is actually
162
+
just a change in state of a running page. In both of these situations, a navigation (or what
163
+
appears to the user as a navigation) can occur without the performance timeline being reset.
164
+
In order to allow developers to reason about such events during the life of a page, some
165
+
PerformanceEntry objects mark navigations, or navigation-like events. All PerformanceEntry
166
+
objects include a navigation ID field, which ties each PerformanceEntry to the most recent
167
+
navigation entry which had occurred before the entry was generated.
168
+
153
169
# Standards Status
154
170
The Performance Timeline specification is widely approved.
155
171
There are differences in what kinds of performance data is exposed on different user agents, but this specification does not concern itself with that, and that is delegated to the new specifications that describe new data.
0 commit comments