--- title: Performance.clearMeasures() slug: Web/API/Performance/clearMeasures translation_of: Web/API/Performance/clearMeasures ---
clearMeasures()
方法可以从浏览器的性能入口缓存区中移除声明的度量衡。如果这个方法被调用时没有传入参数,则所有 {{domxref("PerformanceEntry.entryType","entry type")}} 标记值为"measure
" 的{{domxref("PerformanceEntry","性能实体")}}将被从性能入口缓存区中移除。
{{AvailableInWorkers}}
performance.clearMeasures(); performance.clearMeasures(name);
measure
" 的{{domxref("PerformanceEntry","性能实体")}}将被移除。下面的两个例子演示了 clearMeasures()
的用法。
function clear_measure(name) { if (performance.clearMeasures === undefined) { console.log("performance.clearMeasures Not supported"); return; } // 根据给定的 name移除所有标记类型为 "measure" 的性能入口
performance.clearMeasures(name); } function clear_all_measures() { if (performance.clearMeasures === undefined) { console.log("performance.clearMeasures Not supported"); return; } //移除性能缓存区中所有标记类型为 "measure" 的性能入口
performance.clearMeasures(); }
Specification | Status | Comment |
---|---|---|
{{SpecName('User Timing Level 2', '#dom-performance-clearmeasures', 'clearMeasures()')}} | {{Spec2('User Timing Level 2')}} | Clarifies clearMeasures() . |
{{SpecName('User Timing', '#dom-performance-clearmeasures', 'clearMeasures()')}} | {{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)}} |