性能监测对象

这篇翻译不完整。请帮忙从英语翻译这篇文章

PerformanceObserver 用于监测性能度量事件,在浏览器的性能时间轴记录下一个新的 performance entries  的时候将会被通知 。
 
Note: 此特性在 Web Worker 中可用。

构造函数

PerformanceObserver()
创建并返回一个新的 PerformanceObserver 对象。

方法

PerformanceObserver.observe()
指定监测的 entry types 的集合。 当 performance entry 被记录并且是指定的 entryTypes 之一的时候,性能观察者对象的回调函数会被调用。
PerformanceObserver.disconnect()
性能监测回调停止接收 性能条目

示例

function perf_observer(list, observer) { 
   // Process the "measure" event 
} 
var observer2 = new PerformanceObserver(perf_observer); 
observer2.observe({entryTypes: ["measure"]});

规范

规范草案 状态 注释
Performance Timeline Level 2
PerformanceObserver
Candidate Recommendation Initial definition of PerformanceObserver interface.

浏览器兼容性

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
Basic supportChrome Full support 52Edge ? Firefox Full support 57IE No support NoOpera Full support 39Safari Full support 11WebView Android Full support YesChrome Android Full support 52Edge Mobile ? Firefox Android Full support 57Opera Android Full support 39Safari iOS Full support 11Samsung Internet Android ?
Available in workersChrome Full support 62Edge ? Firefox ? IE No support NoOpera Full support 49Safari ? WebView Android Full support 62Chrome Android Full support 62Edge Mobile ? Firefox Android ? Opera Android Full support 49Safari iOS ? Samsung Internet Android ?
PerformanceObserver() constructorChrome Full support 52Edge ? Firefox Full support 57IE No support NoOpera Full support 39Safari Full support 11WebView Android No support NoChrome Android Full support 52Edge Mobile ? Firefox Android Full support 57Opera Android Full support 39Safari iOS Full support 11Samsung Internet Android ?
disconnectChrome Full support 52Edge ? Firefox Full support 57IE No support NoOpera Full support 39Safari Full support 11WebView Android No support NoChrome Android Full support 52Edge Mobile ? Firefox Android Full support 57Opera Android Full support 39Safari iOS Full support 11Samsung Internet Android ?
observeChrome Full support 52Edge ? Firefox Full support 57IE No support NoOpera Full support 39Safari Full support 11WebView Android No support NoChrome Android Full support 52Edge Mobile ? Firefox Android Full support 57Opera Android Full support 39Safari iOS Full support 11Samsung Internet Android ?
takeRecords
Experimental
Chrome Full support YesEdge ? Firefox Full support 60IE No support NoOpera Full support YesSafari No support NoWebView Android No support NoChrome Android Full support YesEdge Mobile ? Firefox Android Full support 60Opera Android Full support YesSafari iOS No support NoSamsung Internet Android ?

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown
Experimental. Expect behavior to change in the future.
Experimental. Expect behavior to change in the future.

文档标签和贡献者

此页面的贡献者: Jiang-Xuan, warmilk, stefanjudis
最后编辑者: Jiang-Xuan,