entryType
特性返回
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.
| 值 | 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
|
要么
'first-paint'
or
'first-contentful-paint'
.
|
longtask
|
PerformanceLongTaskTiming
|
DOMString
|
reports instances of long tasks |
The following example shows the use of the
entryType
特性。
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);
}
}
| 规范 | 状态 | 注释 |
|---|---|---|
|
Performance Timeline Level 2
The definition of 'entryType' in that specification. |
候选推荐 | |
|
性能时间线
The definition of 'entryType' in that specification. |
推荐 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
entryType
|
Chrome Yes | Edge 12 | Firefox Yes | IE Yes | Opera Yes | Safari 11 | WebView Android Yes | Chrome Android Yes | Firefox Android 25 | Opera Android Yes | Safari iOS 11 | Samsung Internet Android Yes |
完整支持
PerformanceEntry