/
index.md
65 lines (44 loc) · 1.71 KB
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
---
title: "Performance: clearMarks() メソッド"
short-title: clearMarks()
slug: Web/API/Performance/clearMarks
l10n:
sourceCommit: 312081aabba3885b35a81107b3c2fc53428896c5
---
{{APIRef("Performance API")}}
**`clearMarks()`** メソッドは、すべての、または特定の {{domxref("PerformanceMark")}} オブジェクトを、ブラウザーのパフォーマンスタイムラインから除去します。
## 構文
```js-nolint
clearMarks()
clearMarks(name)
```
### 引数
- `name` {{optional_inline}}
- : 文字列で、 {{domxref("PerformanceMark")}} オブジェクトの{{domxref("PerformanceEntry.name", "名前", "", 1)}}を表します。この引数を省略すると、 {{domxref("PerformanceEntry.entryType","entryType")}} が "`mark`" であるすべての項目が除去されます。
### 返値
なし ({{jsxref("undefined")}})。
## 例
### マーカーを除去
パフォーマンスマークをすべて、あるいは特定の項目だけを消去するには、次のように `clearMarks()` メソッドを使用します。
```js
// マークの束を作成
performance.mark("login-started");
performance.mark("login-started");
performance.mark("login-finished");
performance.mark("form-sent");
performance.mark("video-loaded");
performance.mark("video-loaded");
performance.getEntriesByType("mark").length; // 6
// "login-started" マーク項目のみを削除
performance.clearMarks("login-started");
performance.getEntriesByType("mark").length; // 4
// すべてのマーク項目を削除
performance.clearMarks();
performance.getEntriesByType("mark").length; // 0
```
## 仕様書
{{Specifications}}
## ブラウザーの互換性
{{Compat}}
## 関連情報
- {{domxref("PerformanceMark")}}