A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developer.mozilla.org/en-US/docs/Web/API/PerformanceObserver below:

PerformanceObserver - Web APIs | MDN

PerformanceObserver

Baseline Widely available *

Note: This feature is available in Web Workers.

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.

Constructor
PerformanceObserver()

Creates and returns a new PerformanceObserver object.

Static properties
PerformanceObserver.supportedEntryTypes Read only

Returns an array of the entryType values supported by the user agent.

Instance methods
PerformanceObserver.observe()

Specifies the set of entry types to observe. The performance observer's callback function will be invoked when performance entry is recorded for one of the specified entryTypes.

PerformanceObserver.disconnect()

Stops the performance observer callback from receiving performance entries.

PerformanceObserver.takeRecords()

Returns the current list of performance entries stored in the performance observer, emptying it out.

Examples Creating a PerformanceObserver

The following example creates a PerformanceObserver watching for "mark" (PerformanceMark) and "measure" (PerformanceMeasure) events. The perfObserver callback provides a list (PerformanceObserverEntryList) which allows you to get observed performance entries.

function perfObserver(list, observer) {
  list.getEntries().forEach((entry) => {
    if (entry.entryType === "mark") {
      console.log(`${entry.name}'s startTime: ${entry.startTime}`);
    }
    if (entry.entryType === "measure") {
      console.log(`${entry.name}'s duration: ${entry.duration}`);
    }
  });
}
const observer = new PerformanceObserver(perfObserver);
observer.observe({ entryTypes: ["measure", "mark"] });
Specifications Browser compatibility See also

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.3