--- title: performance.clearMarks() slug: Web/API/Performance/clearMarks tags: - API - Web パフォーマンス - メソッド translation_of: Web/API/Performance/clearMarks ---
clearMarks() メソッドは、ブラウザのパフォーマンスエントリバッファから名前付きマークを削除します。
このメソッドが引数なしで呼び出された場合、{{domxref("PerformanceEntry.entryType","エントリタイプ")}} が "mark" の{{domxref("PerformanceEntry","パフォーマンスエントリ")}}はすべてパフォーマンスエントリバッファから削除されます。
{{AvailableInWorkers}}
performance.clearMarks(); performance.clearMarks(name);
mark" であるすべての {{domxref("PerformanceEntry","performance entries")}} が削除されます。次の例は、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"
| 仕様書 | ステータス | コメント |
|---|---|---|
| {{SpecName('User Timing Level 2', '#dom-performance-clearmarks', 'clearMarks()')}} | {{Spec2('User Timing Level 2')}} | clearMarks() を明確にします。 |
| {{SpecName('User Timing', '#dom-performance-clearmarks', 'clearMarks()')}} | {{Spec2('User Timing')}} | 基本的な定義 |
{{Compat("api.Performance.clearMarks")}}