clearMarks()
メソッドは、ブラウザのパフォーマンスエントリバッファから名前付きマークを削除します。
このメソッドが引数なしで呼び出された場合、エントリタイプ
が "mark
" のパフォーマンスエントリ
はすべてパフォーマンスエントリバッファから削除されます。
註: この機能は Web Workers 内で利用可能です。
構文
performance.clearMarks(); performance.clearMarks(name);
引数
- name Optional
- タイムスタンプの名前を表す
DOMString
。 この引数を省略すると、entry type
が "mark
" であるすべてのperformance entries
が削除されます。
戻り値
- void
例
次の例は、clearMarks()
メソッドの両方の使用法を示しています。
// Create a small helper to show how many PerformanceMark entries there are.
function logMarkCount() {
console.log(
"Found this many entries: " + performance.getEntriesByType("mark").length
);
}
// Create a bunch of marks.
performance.mark("squirrel");
performance.mark("squirrel");
performance.mark("monkey");
performance.mark("monkey");
performance.mark("dog");
performance.mark("dog");
logMarkCount() // "Found this many entries: 6"
// Delete just the "squirrel" PerformanceMark entries.
performance.clearMarks('squirrel');
logMarkCount() // "Found this many entries: 4"
// Delete all of the PerformanceMark entries.
performance.clearMarks();
logMarkCount() // "Found this many entries: 0"
仕様
仕様書 | ステータス | コメント |
---|---|---|
User Timing Level 2 clearMarks() の定義 |
草案 | clearMarks() を明確にします。 |
User Timing clearMarks() の定義 |
勧告 | 基本的な定義 |
ブラウザの互換性
BCD tables only load in the browser
このページの互換性テーブルは構造化データから生成されます。データに貢献したい場合は https://github.com/mdn/browser-compat-data をチェックして、プルリクエストを送ってください。