PerformanceEntry.entryType
entryType
プロパティは、たとえば "mark
" などのパフォーマンスメトリックの種類を表す DOMString
を返します。このプロパティは読み取り専用です。
注: この機能は Web Worker 内で利用可能です
構文
var type = entry.entryType;
返値
返値は PerformanceEntry
オブジェクトのサブタイプに依存し、次の表に示すように PerformanceEntry.name
プロパティの値に影響します。
パフォーマンスエントリタイプの名前
値 | サブタイプ | name プロパティのタイプ | name プロパティの説明 |
---|---|---|---|
frame , navigation |
PerformanceFrameTiming , PerformanceNavigationTiming |
URL |
ドキュメントのアドレス |
resource |
PerformanceResourceTiming |
URL |
リクエストされたリソースの解決された URL。リクエストがリダイレクトされても、この値は変わりません。 |
mark |
PerformanceMark |
DOMString |
performance.mark() を呼び出してマークを作成したときに使用された名前 |
measure |
PerformanceMeasure |
DOMString |
メジャーが performance.measure() を呼び出して作成されたときに使用された名前 |
paint |
PerformancePaintTiming |
DOMString |
'first-paint' もしくは 'first-contentful-paint' のいずれか |
例
次の例は、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);
}
}
仕様書
Specification |
---|
Performance Timeline # dom-performanceentry-entrytype |
ブラウザーの互換性
BCD tables only load in the browser