performance.clearMeasures()
clearMeasures()
メソッドは、ブラウザのパフォーマンスエントリバッファから名前付きメジャーを削除します。
メソッドが引数なしで呼び出された場合、エントリタイプが "measure" のパフォーマンスエントリ
はすべてパフォーマンスエントリバッファから削除されます。
注:
この機能は Web Worker 内で利用可能です。構文
performance.clearMeasures(); performance.clearMeasures(name);
引数
- name 省略可
- タイムスタンプの名前を表す
DOMString
。この引数を省略すると、エントリタイプ
が "measure
" のパフォーマンスエントリ
がすべて削除されます。
戻り値
- void
例
次の例は、clearMeasures()
メソッドの両方の使用方法を示しています。
// Create a small helper to show how many PerformanceMeasure entries there are.
function logMeasureCount() {
console.log(
"Found this many entries: " + performance.getEntriesByType("measure").length
);
}
// Create a bunch of measures.
performance.measure("from navigation");
performance.mark("a");
performance.measure("from mark a", "a");
performance.measure("from navigation");
performance.measure("from mark a", "a");
performance.mark("b");
performance.measure("between a and b", "a", "b");
logMeasureCount() // "Found this many entries: 5"
// Delete just the "from navigation" PerformanceMeasure entries.
performance.clearMeasures("from navigation");
logMeasureCount() // "Found this many entries: 3"
// Delete all of the PerformanceMeasure entries.
performance.clearMeasures();
logMeasureCount() // "Found this many entries: 0"
仕様
仕様書 | ステータス | コメント |
---|---|---|
User Timing Level 2 clearMeasures() の定義 |
草案 | clearMeasures() を明確にします。 |
User Timing clearMeasures() の定義 |
勧告 | 基本的な定義 |
ブラウザの互換性
BCD tables only load in the browser