blob: ed92f19a271c8fec4d1b60300427d0ee52a6584e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
---
title: Console.timeStamp()
slug: Web/API/Console/timeStamp
translation_of: Web/API/Console/timeStamp
---
<div>{{APIRef("Console API")}}{{Non-standard_header}}</div>
<p>向浏览器的 <a href="https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference">Performance</a> 或者 <a href="https://developer.mozilla.org/en-US/docs/Tools/Performance/Waterfall">Waterfall</a> 工具添加一个标记。这样可以让你将代码中的一个点和其他在时间轴上已记录的事件相关联,例如布局事件和绘制事件等。</p>
<p>你可以选择用一个参数来作为时间戳标签,然后标记旁边就会显示这个标签。</p>
<p>{{AvailableInWorkers}}</p>
<h2 id="Syntax">Syntax</h2>
<pre class="syntaxbox">console.timeStamp(label);
</pre>
<h2 id="Parameters">Parameters</h2>
<dl>
<dt><code>label</code></dt>
<dd>Label for the timestamp. Optional.</dd>
</dl>
<h2 id="Browser_compatibility">Browser compatibility</h2>
<p>{{CompatibilityTable}}</p>
<div id="compat-desktop">{{CompatUnknown}}
<table class="compat-table">
<tbody>
<tr>
<th>Feature</th>
<th>Chrome</th>
<th>Firefox (Gecko)</th>
<th>Internet Explorer</th>
<th>Opera</th>
<th>Safari</th>
</tr>
<tr>
<td>Basic support</td>
<td>{{CompatVersionUnknown}}</td>
<td>{{CompatVersionUnknown}}</td>
<td>{{CompatNo}}</td>
<td>{{CompatVersionUnknown}}</td>
<td>{{CompatVersionUnknown}}</td>
</tr>
<tr>
<td>Available in workers</td>
<td>{{CompatVersionUnknown}}</td>
<td>{{CompatGeckoDesktop("38.0")}}</td>
<td>{{CompatVersionUnknown}}</td>
<td>{{CompatVersionUnknown}}</td>
<td>{{CompatVersionUnknown}}</td>
</tr>
</tbody>
</table>
</div>
<div id="compat-mobile">
<table class="compat-table">
<tbody>
<tr>
<th>Feature</th>
<th>Android</th>
<th>Firefox Mobile (Gecko)</th>
<th>IE Mobile</th>
<th>Opera Mobile</th>
<th>Safari Mobile</th>
</tr>
<tr>
<td>Basic support</td>
<td>{{CompatUnknown}}</td>
<td>{{CompatGeckoMobile("10.0")}}</td>
<td>{{CompatUnknown}}</td>
<td>{{CompatUnknown}}</td>
<td>{{CompatUnknown}}</td>
</tr>
<tr>
<td>Available in workers</td>
<td>{{CompatUnknown}}</td>
<td>{{CompatGeckoMobile("38.0")}}</td>
<td>{{CompatUnknown}}</td>
<td>{{CompatUnknown}}</td>
<td>{{CompatUnknown}}</td>
</tr>
</tbody>
</table>
</div>
<h2 id="See_also">See also</h2>
<ul>
<li>{{domxref("Console.time()")}}</li>
<li>{{domxref("Console.timeEnd()")}}</li>
<li><a href="/en-US/docs/Tools/Performance/Waterfall#Timestamp_markers">Adding timestamps to the Waterfall</a></li>
</ul>
|