The read-only startTime property returns the first timestamp recorded for this performance entry. The meaning of this property depends on the value of this entry's entryType.
The read-only startTime property returns the first timestamp recorded for this performance entry. The meaning of this property depends on the value of this entry's entryType.
A DOMHighResTimeStamp representing the first timestamp when the performance entry was created.
The meaning of this property depends on the value of this performance entry's entryType:
elementEither the value of this entry's renderTime if it is not 0, otherwise the value of this entry's loadTime.
eventThe time the event was created, i.e. the event's timeStamp property.
first-inputThe time the first input event was created, i.e. that event's timeStamp.
largest-contentful-paintThe value of this entry's renderTime if it is not 0, otherwise the value of this entry's loadTime.
layout-shiftThe time when the layout shift started.
longtaskThe time when the task started.
markThe time at which the mark was created by a call to performance.mark().
measureThe time at which the measure was created by a call to performance.measure().
Always 0.
paintThe time when the paint occurred.
resourceThe value of this entry's fetchStart property.
taskattributionAlways 0.
visibility-stateThe time when the visibility state change occurred.
The following example shows the use of the startTime property which you can log during performance observation.
Note: The performance.mark() method allows you to set your own startTime, and the performance.measure() method allows to set the start of the measure.
js
performance.mark("my-mark"); performance.mark("my-other-mark", { startTime: 12.5 }); loginButton.addEventListener("click", (clickEvent) => { performance.measure("login-click", { start: clickEvent.timeStamp }); }); function perfObserver(list, observer) { list.getEntries().forEach((entry) => { if (entry.entryType === "mark") { console.log(`${entry.name}'s startTime: ${entry.startTime}`); } if (entry.entryType === "measure") { console.log(`${entry.name}'s duration: ${entry.duration}`); } }); } const observer = new PerformanceObserver(perfObserver); observer.observe({ entryTypes: ["measure", "mark"] });
| Specification |
|---|
| Performance Timeline # dom-performanceentry-starttime |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
startTime |
28 | 12 | 35 | 10 | 15 | 11 | 4.4 | 28 | 35 | 14 | 11 | 1.5 |
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/PerformanceEntry/startTime