PerformanceEntry: startTime property

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2017.

Note: This feature is available in Web Workers.

The read-only startTime property returns the first timestamp recorded for this PerformanceEntry. The meaning of this property depends on the value of this entry's entryType.

Value

A DOMHighResTimeStamp representing the first timestamp when the PerformanceEntry was created.

The meaning of this property depends on the value of this performance entry's entryType:

element

Either the value of this entry's renderTime if it is not 0, otherwise the value of this entry's loadTime.

event

The time the event was created, i.e., the event's timeStamp property.

first-input

The time the first input event was created, i.e., that event's timeStamp.

largest-contentful-paint

The value of this entry's renderTime if it is not 0, otherwise the value of this entry's loadTime.

layout-shift

The time when the layout shift started.

longtask

The time when the task started.

mark

The time at which the mark was created by a call to performance.mark().

measure

The time at which the measure was created by a call to performance.measure().

Always 0.

paint

The time when the paint occurred.

resource

The value of this entry's fetchStart property.

taskattribution

Always 0.

visibility-state

The time when the visibility state change occurred.

Examples

Using the startTime property

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"] });

Specifications

Specification
Performance Timeline
# dom-performanceentry-starttime

Browser compatibility

desktop mobile server
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Bun
Deno
Node.js
startTime
Chrome – Full support
Chrome 28 (Release date: 2013-07-09)
footnote Full support
Edge – Full support
Edge 12 (Release date: 2015-07-29)
footnote Full support
Firefox – Full support
Firefox 35 (Release date: 2015-01-13)
footnote Full support
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – Full support
Safari 11 (Release date: 2017-09-19)
footnote Full support
Chrome Android – Full support
Chrome Android 28 (Release date: 2013-07-10)
footnote Full support
Firefox for Android – Full support
Firefox for Android 35 (Release date: 2015-01-13)
footnote Full support
Opera Android – Full support
Opera Android 14 (Release date: 2013-05-21)
footnote Full support
Safari on iOS – Full support
Safari on iOS 11 (Release date: 2017-09-19)
footnote Full support
Samsung Internet – Full support
Samsung Internet 1.5 (Release date: 2013-09-25)
footnote Full support
WebView Android – Full support
WebView Android 4.4 (Release date: 2013-12-09)
footnote Full support
WebView on iOS – Full support
WebView on iOS 11 (Release date: 2017-09-19)
footnote Full support
Bun – Full support
Bun 1.0.22 (Release date: 2024-01-10)
footnote Full support
Deno – Full support
Deno 1.2 (Release date: 2020-07-13)
footnote Full support
Node.js – Full support
Node.js 8.5 (Release date: 2017-09-12)
footnote Full support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support