PerformanceEntry.entryType

The entryType property returns a DOMString representing the type of performance metric such as, for example, "mark". This property is read only.

Note: This feature is available in Web Workers.

Syntax

var type = entry.entryType;

Return value

The return value depends on the subtype of the PerformanceEntry object and affects the value of the PerformanceEntry.name property as shown by the table below. 

Value Subtype Type of name property Description of name property
frame, navigation PerformanceFrameTiming, PerformanceNavigationTiming URL The document's address.
resource PerformanceResourceTiming URL The resolved URL of the requested resource. This value doesn't change even if the request is redirected.
mark PerformanceMark DOMString The name used when the mark was created by calling performance.mark().
measure PerformanceMeasure DOMString name used when the measure was created by calling performance.measure().
paint PerformancePaintTiming DOMString Either 'first-paint' or 'first-contentful-paint'.

 

Example

The following example shows the use of the entryType property.

function run_PerformanceEntry() {

  // check for feature support before continuing
  if (performance.mark === undefined) {
    console.log("performance.mark not supported");
    return;
  }

  // Create a performance entry named "begin" via the mark() method
  performance.mark("begin");
  
  // Check the entryType of all the "begin" entries
  var entriesNamedBegin = performance.getEntriesByName("begin");
	for (var i=0; i < entriesNamedBegin.length; i++) {
      var typeOfEntry = entriesNamedBegin[i].entryType;
      console.log("Entry is type: " + typeOfEntry);
  }

}

Specifications

Specification Status Comment
Performance Timeline Level 2
The definition of 'entryType' in that specification.
Candidate Recommendation  
Performance Timeline
The definition of 'entryType' in that specification.
Recommendation Initial definition.

Browser compatibility

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support. (Yes) (Yes) (Yes) (Yes) (Yes) No support
Avaialable on workers 62 ? ? ? 49 ?
Feature Android Webview Chrome for Android Edge Firefox Mobile (Gecko) Firefox OS IE Phone Opera Mobile Safari Mobile
Basic support. (Yes) (Yes) (Yes) 25.0 (25.0) 1.2 (25.0) 10.0 (Yes) No support
Avaialable on workers 62 62 ? ? ? ? 49 ?

Document Tags and Contributors

Contributors to this page: chrisdavidmills, jpmedley, abbycar, stephaniehobson, AFBarstow
Last updated by: chrisdavidmills,