--- title: Performance slug: Web/API/Performance tags: - API - Interface - Performance - Web Performance translation_of: Web/API/Performance ---
Performance
接口可以获取到当前页面中与性能相关的信息。它是 High Resolution Time API 的一部分,同时也融合了 Performance Timeline API、Navigation Timing API、 User Timing API 和 Resource Timing API。
该类型的对象可以通过调用只读属性 {{domxref("Window.performance")}} 来获得。
注意:除了以下指出的情况外,该接口及其成员在 {{domxref("Web Worker")}} 中可用。此外,还需注意,performance 的创建和衡量都是同一环境下的。即,如果你在主线程(或者其他 worker)中创建了一个 performance,那么它在另外的 worker 线程中是不可用的;反之亦然。
Performance
接口没有继承任何属性。
Performance
接口没有继承任何方法。
resource
" 的 {{domxref("PerformanceEntry","performance entries")}}。resource
" {{domxref("PerformanceEntry.entryType","type")}} {{domxref("PerformanceEntry","performance entry")}} 对象的指定数量Performance
对象的 JSON 对象Specification | Status | Comment |
---|---|---|
{{SpecName('Highres Time Level 3', '#dom-performance-timeorigin','timeOrigin')}} | {{Spec2('Highres Time Level 3')}} | Defines timeOrigin property. |
{{SpecName('Highres Time Level 2', '#the-performance-interface', 'toJSON()')}} | {{Spec2('Highres Time Level 2')}} | Defines toJson() method. |
{{SpecName('Highres Time', '#the-performance-interface', 'Performance')}} | {{Spec2('Highres Time')}} | Defines now() method. |
{{SpecName('Navigation Timing', '#sec-window.performance-attribute', 'Performance')}} | {{Spec2('Navigation Timing')}} | Defines timing and navigation properties. |
{{SpecName('Performance Timeline Level 2', '#extensions-to-the-performance-interface', 'Performance extensions')}} | {{Spec2('Performance Timeline Level 2')}} | Changes getEntries() interface. |
{{SpecName('Performance Timeline', '#sec-window.performance-attribute', 'Performance extensions')}} | {{Spec2('Performance Timeline')}} | Defines getEntries() , getEntriesByType() and getEntriesByName() methods. |
{{SpecName('Resource Timing', '#extensions-performance-interface', 'Performance extensions')}} | {{Spec2('Resource Timing')}} | Defines clearResourceTimings() and setResourceTimingBufferSize() methods and the onresourcetimingbufferfull property. |
{{SpecName('User Timing Level 2', '#extensions-performance-interface', 'Performance extensions')}} | {{Spec2('User Timing Level 2')}} | Clarifies mark() , clearMark() , measure() and clearMeasure() methods. |
{{SpecName('User Timing', '#extensions-performance-interface', 'Performance extensions')}} | {{Spec2('User Timing')}} | Defines mark() , clearMark() , measure() and clearMeasure() methods. |
{{Compat("api.Performance")}}