files/en-us/web/api/layoutshift/lastinputtime/index.md
{{SeeCompatTable}}{{APIRef("Performance API")}}
The lastInputTime read-only property of the {{domxref("LayoutShift")}} interface returns the time of the most recent excluding input or 0 if no excluding input has occurred.
Layout shifts are only bad if the user wasn't expecting them. Layout shift metrics like {{glossary("CLS")}} exclude shifts that occurred soon after certain user interactions. These interactions are called excluding inputs. Excluding inputs are:
mousedown, keydown, and pointerdown)change events.The mousemove and pointermove events are not excluding inputs.
A {{domxref("DOMHighResTimeStamp")}} indicating the most recent excluding input time or 0 if no excluding input has occurred.
Log excluding input times if excluding input has occurred.
const observer = new PerformanceObserver((list) => {
list.getEntries().forEach((entry) => {
if (entry.lastInputTime) {
console.log(entry.lastInputTime);
}
});
});
observer.observe({ type: "layout-shift", buffered: true });
{{Specifications}}
{{Compat}}