Skip to content

Instantly share code, notes, and snippets.

@ishowshao
Last active December 4, 2017 08:45
Show Gist options
  • Save ishowshao/1600cc3459edc3af126f802a0b1b25ba to your computer and use it in GitHub Desktop.
Save ishowshao/1600cc3459edc3af126f802a0b1b25ba to your computer and use it in GitHub Desktop.
Navigation Timing

Navigation Timing

Introduction

这份规范介绍了和WebApp的时间信息相关的一个接口,没有覆盖如何收集、存储、上报接口提供的信息。

PerformanceTiming 接口

接口定义:

interface PerformanceTiming {
  readonly attribute unsigned long long navigationStart;
  readonly attribute unsigned long long unloadEventStart;
  readonly attribute unsigned long long unloadEventEnd;
  readonly attribute unsigned long long redirectStart;
  readonly attribute unsigned long long redirectEnd;
  readonly attribute unsigned long long fetchStart;
  readonly attribute unsigned long long domainLookupStart;
  readonly attribute unsigned long long domainLookupEnd;
  readonly attribute unsigned long long connectStart;
  readonly attribute unsigned long long connectEnd;
  readonly attribute unsigned long long secureConnectionStart;
  readonly attribute unsigned long long requestStart;
  readonly attribute unsigned long long responseStart;
  readonly attribute unsigned long long responseEnd;
  readonly attribute unsigned long long domLoading;
  readonly attribute unsigned long long domInteractive;
  readonly attribute unsigned long long domContentLoadedEventStart;
  readonly attribute unsigned long long domContentLoadedEventEnd;
  readonly attribute unsigned long long domComplete;
  readonly attribute unsigned long long loadEventStart;
  readonly attribute unsigned long long loadEventEnd;
};

navigationStart 属性

此属性必须在用户代理(浏览器)完成提示卸载以前的文档后立即返回时间。 如果没有以前的文档,则此属性必须返回与fetchStart相同的值。

unloadEventStart 属性

如果以前的文档和当前文档具在同域下,则此属性必须返回用户代理启动之前文档的卸载事件之前的时间。 如果没有以前的文档或以前的文档与当前文档不在同一域下,则此属性必须返回零。

unloadEventEnd 属性

如果以前的文档和当前文档具在同域下,则此属性必须返回用户代理启动之前文档的卸载事件之后的时间。 如果没有以前的文档或以前的文档与当前文档不在同一域下,则此属性必须返回零。

如果在导航时存在HTTP重定向或等效项,并且并非所有重定向或等效项来自同一个域,则unloadEventStart和unloadEventEnd都必须返回零。

redirectStart 属性

如果在导航时存在HTTP重定向或等效项,并且所有重定向或等效项来自同一个源,则此属性必须返回启动重定向的开始时间。 否则,该属性必须返回零。

redirectEnd 属性

如果在导航时存在HTTP重定向或等效项,并且所有重定向和等效项来自同一个域,则此属性必须在收到最后一个重定向响应的最后一个字节后立即返回时间。 否则,该属性必须返回零。

fetchStart 属性

如果要使用HTTP GET或等价的方式获取新资源,则fetchStart必须在用户代理开始检查任何相关应用程序缓存之前立即返回时间。 否则,它必须返回用户代理开始获取资源的时间。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment