diff options
Diffstat (limited to 'files/zh-cn/web/api/performance/clearmarks/index.html')
-rw-r--r-- | files/zh-cn/web/api/performance/clearmarks/index.html | 132 |
1 files changed, 132 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/performance/clearmarks/index.html b/files/zh-cn/web/api/performance/clearmarks/index.html new file mode 100644 index 0000000000..5ccd6a016b --- /dev/null +++ b/files/zh-cn/web/api/performance/clearmarks/index.html @@ -0,0 +1,132 @@ +--- +title: Performance.clearMarks() +slug: Web/API/Performance/clearMarks +translation_of: Web/API/Performance/clearMarks +--- +<div>{{APIRef("User Timing API")}}</div> + +<p><strong><code>clearMarks()</code></strong> 这个方法可以从浏览器的performance entry 缓存中移除声明的标记。如果调用这个方法时没有传递参数, 则所有带有{{domxref("PerformanceEntry.entryType","entry type")}}这类标记的{{domxref("PerformanceEntry","performance entries")}} 将从 performance entry 缓存区中被移除。</p> + +<h2 id="用法">用法</h2> + +<pre class="syntaxbox"><em>performance</em>.clearMarks(); +<em>performance</em>.clearMarks(name); +</pre> + +<h3 id="参数">参数</h3> + +<dl> + <dt>name {{optional_inline}}</dt> + <dd>{{domxref("DOMString")}} 表示时间戳的名字,如果没有提供这个参数, 则所有带有{{domxref("PerformanceEntry.entryType","entry type")}}这类标记的{{domxref("PerformanceEntry","performance entries")}} 将从 performance entry 缓存区中被移除。</dd> +</dl> + +<h3 id="返回值">返回值</h3> + +<dl> + <dt>void</dt> + <dd> </dd> +</dl> + +<h2 id="例子">例子</h2> + +<p>下面的例子演示<code>clearMarks() 的两种用法。</code></p> + +<pre class="brush: js">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(); +} +</pre> + +<h2 id="说明">说明</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">说明</th> + <th scope="col">状态</th> + <th scope="col">备注</th> + </tr> + <tr> + <td>{{SpecName('User Timing Level 2', '#dom-performance-clearmarks', 'clearMarks()')}}</td> + <td>{{Spec2('User Timing Level 2')}}</td> + <td>Clarifies <code>clearMarks()</code>.</td> + </tr> + <tr> + <td>{{SpecName('User Timing', '#dom-performance-clearmarks', 'clearMarks()')}}</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> |