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.
Performance entry type names
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' .
|
longtask
|
PerformanceLongTaskTiming
|
DOMString
|
reports instances of long tasks |
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 2The definition of 'entryType' in that specification. | Candidate Recommendation | |
Performance TimelineThe definition of 'entryType' in that specification. | Recommendation | Initial definition. |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
entryType
|
Chrome
Full support Yes |
Edge
Full support 12 |
Firefox
Full support Yes |
IE
Full support Yes |
Opera
Full support Yes |
Safari
Full support 11 |
WebView Android
Full support Yes |
Chrome Android
Full support Yes |
Firefox Android
Full support 25 |
Opera Android
Full support Yes |
Safari iOS
Full support 11 |
Samsung Internet Android
Full support Yes |
Legend
- Full support
- Full support
PerformanceEntry.entryType by Mozilla Contributors is licensed under CC-BY-SA 2.5.