1 line
1.4 KiB
JSON
1 line
1.4 KiB
JSON
{"name":"event.timeStamp","type":"property","title":"event.timeStamp","deprecated":null,"removed":null,"desc":"The difference in milliseconds between the time the browser created the event and January 1, 1970.","categories":["events/event-object","version/1.2.6"],"entries":[{"return":"Number","signatures":{"added":"1.2.6"},"examples":{"desc":"Display the time since the click handler last executed.","css":"\n div {\n height: 100px;\n width: 300px;\n margin: 10px;\n background-color: #ffd;\n overflow: auto;\n }\n","code":"\nvar last, diff;\n$( \"div\" ).click(function( event ) {\n if ( last ) {\n diff = event.timeStamp - last;\n $( \"div\" ).append( \"time since last event: \" + diff + \"<br>\" );\n } else {\n $( \"div\" ).append( \"Click again.<br>\" );\n }\n last = event.timeStamp;\n});\n","html":"\n<div>Click.</div>\n"},"longdesc":"\n <p>This property can be useful for profiling event performance by getting the <code>event.timeStamp</code> value at two points in the code and noting the difference. To simply determine the current time inside an event handler, use <code>(new Date).getTime()</code> instead.</p>\n <p>Note: Due to a <a href=\"https://bugzilla.mozilla.org/show_bug.cgi?id=238041\">bug open since 2004</a>, this value is not populated correctly in Firefox and it is not possible to know the time the event was created in that browser.</p>\n "}]} |