clearMarks()
method removes the
named mark
from the browser's performance entry buffer. If the method is called with no arguments, all
performance entries
采用
entry type
of "
mark
" will be removed from the performance entry buffer.
performance.clearMarks(); performance.clearMarks(name);
DOMString
representing the name of the timestamp. If this argument is omitted, all
performance entries
采用
entry type
of "
mark
" will be removed.
The following example shows both uses of the
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
The definition of 'clearMarks()' in that specification. |
工作草案 |
Clarifies
clearMarks()
.
|
|
User Timing
The definition of 'clearMarks()' in that specification. |
推荐 | Basic definition. |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
clearMarks
|
Chrome
29
|
Edge 12 | Firefox 41 | IE 10 | Opera 33 | Safari 11 |
WebView Android
≤37
|
Chrome Android
29
|
Firefox Android 42 | Opera Android 33 | Safari iOS 11 |
Samsung Internet Android
2.0
|
完整支持
要求使用供应商前缀或不同名称。
性能