The entryType property returns a DOMString representing the type of performance metric such as, for example, "mark". This property is read only.
var type = entry.entryType;
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'. |
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);
}
}
| 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. |
| Desktop | ||||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
| Basic support | Yes | Yes | Yes | Yes | Yes | 11 |
| Mobile | |||||||
|---|---|---|---|---|---|---|---|
| Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
| Basic support | Yes | Yes | Yes | 25 | Yes | 11 | ? |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/PerformanceEntry/entryType