PerformanceResourceTiming.initiatorType
initiatorType
読み取り専用プロパティは、パフォーマンスイベントを開始したリソースの種類を表す 文字列
です。
この文字列の値は次のとおりです:
- initiator が
Element
の場合、このプロパティは要素のlocalName
を返します - initiator が
CSS
リソースの場合、このプロパティは "css
" を返します - initiator が
XMLHttpRequest
オブジェクトの場合、このプロパティは "xmlhttprequest
" を返します - initiator が
PerformanceNavigationTiming
オブジェクトの場合、このプロパティは空の文字列 (""
) を返します
注: この機能は Web Worker 内で利用可能です
構文
resource.initiatorType;
戻り値
上記で指定したように、パフォーマンスイベントを開始したリソースの種類を表す string
。
例
function print_PerformanceEntries() {
// Use getEntriesByType() to just get the "resource" events
var p = performance.getEntriesByType("resource");
for (var i=0; i < p.length; i++) {
print_initiatorType(p[i]);
}
}
function print_initiatorType(perfEntry) {
// Print this performance entry object's initiatorType value
var value = "initiatorType" in perfEntry;
if (value)
console.log("... initiatorType = " + perfEntry.initiatorType);
else
console.log("... initiatorType = NOT supported");
}
仕様
仕様書 | ステータス | コメント |
---|---|---|
Resource Timing Level 1 initiatorType の定義 |
勧告候補 | 初期定義 |
ブラウザの互換性
BCD tables only load in the browser