aboutsummaryrefslogtreecommitdiff
path: root/files/ru/web/api/event/timestamp/index.html
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:42:52 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:42:52 -0500
commit074785cea106179cb3305637055ab0a009ca74f2 (patch)
treee6ae371cccd642aa2b67f39752a2cdf1fd4eb040 /files/ru/web/api/event/timestamp/index.html
parentda78a9e329e272dedb2400b79a3bdeebff387d47 (diff)
downloadtranslated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.gz
translated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.bz2
translated-content-074785cea106179cb3305637055ab0a009ca74f2.zip
initial commit
Diffstat (limited to 'files/ru/web/api/event/timestamp/index.html')
-rw-r--r--files/ru/web/api/event/timestamp/index.html103
1 files changed, 103 insertions, 0 deletions
diff --git a/files/ru/web/api/event/timestamp/index.html b/files/ru/web/api/event/timestamp/index.html
new file mode 100644
index 0000000000..6a79557c96
--- /dev/null
+++ b/files/ru/web/api/event/timestamp/index.html
@@ -0,0 +1,103 @@
+---
+title: Event.timeStamp
+slug: Web/API/Event/timeStamp
+translation_of: Web/API/Event/timeStamp
+---
+<div>{{APIRef("DOM")}}</div>
+
+<p><span id="result_box" lang="ru"><span>Возвращает время (в миллисекундах), в котором было создано событие.</span></span></p>
+
+<div class="note">
+<p><strong>Примечание: </strong><span id="result_box" lang="ru"><span>Это свойство работает только в том случае, если система событий поддерживает его для конкретного события.</span></span></p>
+</div>
+
+<h2 id="Синтаксис"><span class="short_text" id="result_box" lang="ru"><span>Синтаксис</span></span></h2>
+
+<pre class="syntaxbox"><var>event</var>.timeStamp
+</pre>
+
+<h3 id="Значение">Значение</h3>
+
+<p>Значение - это миллисекунды, прошедшие с начала жизненного цикла текущего документа до создания события.</p>
+
+<p>In newer implementations, the value is a {{domxref("DOMHighResTimeStamp")}}  accurate to 5 microseconds (0.005 ms). In older implementations, the value is a {{domxref("DOMTimeStamp")}}, accurate to a millisecond.</p>
+
+<h2 id="Example">Example</h2>
+
+<h3 id="HTML_content">HTML content</h3>
+
+<pre class="brush: html">&lt;p&gt;
+ Focus this iframe and press any key to get the
+ current timestamp for the keypress event.
+&lt;/p&gt;
+&lt;p&gt;timeStamp: &lt;span id="time"&gt;-&lt;/span&gt;&lt;/p&gt;</pre>
+
+<h3 id="JavaScript_content">JavaScript content</h3>
+
+<pre class="brush: js">function getTime(event) {
+ var time = document.getElementById("time");
+ time.firstChild.nodeValue = event.timeStamp;
+}
+document.body.addEventListener("keypress", getTime);</pre>
+
+<h3 id="Result">Result</h3>
+
+<p>{{EmbedLiveSample("Example", "100%", 100)}}</p>
+
+<h2 id="Reduced_time_precision">Reduced time precision</h2>
+
+<p>To offer protection against timing attacks and fingerprinting, the precision of <code>event.timeStamp</code> might get rounded depending on browser settings.<br>
+ In Firefox, the <code>privacy.reduceTimerPrecision</code>  preference is enabled by default and defaults to 20us in Firefox 59; in 60 it will be 2ms.</p>
+
+<pre class="brush: js">// reduced time precision (2ms) in Firefox 60
+event.timeStamp;
+// 1519211809934
+// 1519211810362
+// 1519211811670
+// ...
+
+
+// reduced time precision with `privacy.resistFingerprinting` enabled
+event.timeStamp;
+// 1519129853500
+// 1519129858900
+// 1519129864400
+// ...
+</pre>
+
+<p>In Firefox, you can also enabled <code>privacy.resistFingerprinting</code>, the precision will be 100ms or the value of <code>privacy.resistFingerprinting.reduceTimerPrecision.microseconds</code>, whichever is larger.</p>
+
+<h2 id="Specifications">Specifications</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName("DOM WHATWG", "#dom-event-timestamp", "Event.timeStamp")}}</td>
+ <td>{{Spec2("DOM WHATWG")}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName("DOM4", "#dom-event-timestamp", "Event.timeStamp")}}</td>
+ <td>{{Spec2("DOM4")}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName("DOM2 Events", "#Events-Event-timeStamp", "Event.timeStamp")}}</td>
+ <td>{{Spec2("DOM2 Events")}}</td>
+ <td>Initial definition</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+
+
+<p>{{Compat("api.Event.timeStamp")}}</p>