--- title: Performance.clearMarks() slug: Web/API/Performance/clearMarks translation_of: Web/API/Performance/clearMarks ---
clearMarks()
这个方法可以从浏览器的performance entry 缓存中移除声明的标记。如果调用这个方法时没有传递参数, 则所有带有{{domxref("PerformanceEntry.entryType","entry type")}}这类标记的{{domxref("PerformanceEntry","performance entries")}} 将从 performance entry 缓存区中被移除。
performance.clearMarks(); performance.clearMarks(name);
下面的例子演示clearMarks() 的两种用法。
function clear_mark(name) { if (performance.clearMarks === undefined) { console.log("performance.clearMarks Not supported"); return; } //移除所有标记了此名称的peformance entry performance.clearMarks(name); } function clear_all_marks() { if (performance.clearMarks === undefined) { console.log("performance.clearMarks Not supported"); return; } //从performance 缓冲区中移除所有标记的performance entry performance.clearMarks(); }
说明 | 状态 | 备注 |
---|---|---|
{{SpecName('User Timing Level 2', '#dom-performance-clearmarks', 'clearMarks()')}} | {{Spec2('User Timing Level 2')}} | Clarifies clearMarks() . |
{{SpecName('User Timing', '#dom-performance-clearmarks', 'clearMarks()')}} | {{Spec2('User Timing')}} | Basic definition. |
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|---|
Basic support | {{CompatChrome(43.0)}} | {{CompatVersionUnknown}} | 41 | 10 | 33 | {{CompatNo}} |
Feature | Android | Android Webview | Edge | Firefox Mobile (Gecko) | Firefox OS | IE Phone | Opera Mobile | Safari Mobile | Chrome for Android |
---|---|---|---|---|---|---|---|---|---|
Basic support | {{CompatNo}} | {{CompatChrome(46.0)}} | {{CompatVersionUnknown}} | 42 | 42 | 10 | 33 | {{CompatNo}} | {{CompatChrome(46.0)}} |