Re: [PerformanceTimeline] Returning Navigation Timing attributes in High Resolution Time

On Wed, Apr 11, 2012 at 1:06 PM, Andy Davies <dajdavies@gmail.com> wrote:

> On 11 April 2012 19:24, Jatinder Mann <jmann@microsoft.com> wrote:
> >
> > You can still compare Navigation Timing and Resource Timing attributes.
> E.g., if you want the difference between the connectStart of the document
> and the first resource, you can do the following:
> >
> > var resourceList = window.performance.getEntriesByType("resource");
> > var delta = resourceList[0].connectStart -
> (window.performance.timing.connectStart -
> window.performance.timing.navigationStart);
> >
>
> Don't know whether I'm missing something here but is resourceList[0]
> actually the HTML page (I couldn't work out from the spec whether it's
> included in the resource list or not)?
>

In this example, no. It'll be the first subresource. The main document
isn't a "resource" entry, it'd be a "navigation" entry.

The order is still a good question though. The spec says getEntries()
should return in chronological order. Is it chronological by startTime? Or
chronological by when the entries are added to the buffer? For resources,
the latter will be sorted by finish time.

James

Received on Friday, 13 April 2012 21:43:15 UTC