aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/performance/clearmeasures/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/zh-cn/web/api/performance/clearmeasures/index.html')
-rw-r--r--files/zh-cn/web/api/performance/clearmeasures/index.html134
1 files changed, 134 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/performance/clearmeasures/index.html b/files/zh-cn/web/api/performance/clearmeasures/index.html
new file mode 100644
index 0000000000..66cd9b0685
--- /dev/null
+++ b/files/zh-cn/web/api/performance/clearmeasures/index.html
@@ -0,0 +1,134 @@
+---
+title: Performance.clearMeasures()
+slug: Web/API/Performance/clearMeasures
+translation_of: Web/API/Performance/clearMeasures
+---
+<div>{{APIRef("User Timing API")}}</div>
+
+<p><strong><code>clearMeasures()</code></strong> 方法可以从浏览器的性能入口缓存区中移除声明的度量衡。如果这个方法被调用时没有传入参数,则所有 {{domxref("PerformanceEntry.entryType","entry type")}} 标记值为"<code>measure</code>" 的{{domxref("PerformanceEntry","性能实体")}}将被从性能入口缓存区中移除。</p>
+
+<p>{{AvailableInWorkers}}</p>
+
+<h2 id="用法">用法</h2>
+
+<pre class="syntaxbox"><em>performance</em>.clearMeasures();
+<em>performance</em>.clearMeasures(name);
+</pre>
+
+<h3 id="参数">参数</h3>
+
+<dl>
+ <dt>name {{optional_inline}}</dt>
+ <dd>用于表述时间戳名称的 {{domxref("DOMString")}}。如果没有提供这个参数,则所有 {{domxref("PerformanceEntry.entryType","entry type")}} 标记值为"<code>measure</code>" 的{{domxref("PerformanceEntry","性能实体")}}将被移除。</dd>
+</dl>
+
+<h3 id="返回值">返回值</h3>
+
+<dl>
+ <dt>void</dt>
+ <dd> </dd>
+</dl>
+
+<h2 id="例子">例子</h2>
+
+<p>下面的两个例子演示了 <code>clearMeasures()</code> 的用法。</p>
+
+<pre class="brush: js">function clear_measure(name) {
+ if (performance.clearMeasures === undefined) {
+ console.log("performance.clearMeasures Not supported");
+ return;
+ }
+ // 根据给定的 name <code>移除所有标记类型为 "measure" 的性能入口</code>
+ performance.clearMeasures(name);
+}
+function clear_all_measures() {
+ if (performance.clearMeasures === undefined) {
+ console.log("performance.clearMeasures Not supported");
+ return;
+ }
+ // <code>移除性能缓存区中所有标记类型为 "measure" 的性能入口</code>
+ performance.clearMeasures();
+}
+</pre>
+
+<h2 id="规范">规范</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('User Timing Level 2', '#dom-performance-clearmeasures', 'clearMeasures()')}}</td>
+ <td>{{Spec2('User Timing Level 2')}}</td>
+ <td>Clarifies <code>clearMeasures()</code>.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('User Timing', '#dom-performance-clearmeasures', 'clearMeasures()')}}</td>
+ <td>{{Spec2('User Timing')}}</td>
+ <td>Basic definition.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Edge</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari (WebKit)</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatChrome(43.0)}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>41</td>
+ <td>10</td>
+ <td>33</td>
+ <td>{{CompatNo}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Android Webview</th>
+ <th>Edge</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>Firefox OS</th>
+ <th>IE Phone</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ <th>Chrome for Android</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatChrome(46.0)}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>42</td>
+ <td>42</td>
+ <td>10</td>
+ <td>33</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatChrome(46.0)}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>