PerformanceObserverEntryList

我们的志愿者还没有将这篇文章翻译为 中文 (简体)加入我们帮助完成翻译!
您也可以阅读此文章的English (US)版。

This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for usage in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the specification changes.

The PerformanceObserverEntryList interface is a list of peformance events that were explicitly observed via the observe() method.

Note: this interface is exposed to Window and Worker.

Methods

PerformanceObserverEntryList.getEntries()
Returns a list of explicitly observed PerformanceEntry objects based on the given filter.
PerformanceObserverEntryList.getEntriesByType()
Returns a list of explicitly observed PerformanceEntry objects of the given entry type.
PerformanceObserverEntryList.getEntriesByName()
Returns a list of explicitly observed PerformanceEntry objects based on the given name and entry type.

Example

// Create observer for all performance event types
// list is of type PerformanceObserveEntryList
var observe_all = new PerformanceObserver(function(list, obs) {
   var perfEntries;
   // Print all entries perfEntries = list.getEntries();
   for (var i=0; i < perfEntries.length; i++) {
      print_perf_entry(perfEntries[i]);
      // do something with it
   }
}

Specifications

Specification Status Comment
Performance Timeline Time Level 2
The definition of 'PerformanceObserverEntryList' in that specification.
Editor's Draft Initial definition.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 52.0 49 (49)[1] No support 39 No support
Feature Android Android Webview Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile Chrome for Android
Basic support No support No support 49.0 (49)[1] No support 39 No support 52.0

[1] Only activated in Nightly builds. Controlled by the dom.enable_performance_observer preference. 

文档标签和贡献者