The PerformanceObserver
interface is used to observe performance measurement events and be notified of new performance entries as they are recorded in the browser's performance timeline.
Note: this interface is exposed to Window
and Worker
.
Constructor
PerformanceObserver()
- Creates a
PerformanceObserver
object.
Methods
PerformanceObserver.observe()
- Specifies the set of
entry types
to observe. The performance observer's callback function will be invoked when aperformance entry
is recorded for one of the specifiedentryTypes
PerformanceObserver.disconnect()
- Stops the performance observer callback from receiving
performance entries
.
Example
function perf_observer(list, observer) { // Process the "measure" event } var observer2 = new PerformanceObserver(perf_observer); observer2.observe({entryTypes: ["measure"]});
Specifications
Specification | Status | Comment |
---|---|---|
Performance Timeline Time Level 2 The definition of 'PerformanceObserver' in that specification. |
Editor's Draft | Initial definition of PerformanceObserver interface. |
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support | 52.0 | 57 (57) | No support | 39 | 11 |
Feature | Android | Android Webview | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile | Chrome for Android |
---|---|---|---|---|---|---|---|
Basic support | No support | No support | 57.0 (57) | No support |
39 |
No support | 52.0 |