measure INP
Wed Jan 10 2024 11:37:57 GMT+0000 (Coordinated Universal Time)
Saved by
@dona__x
let worstInp = 0;
const observer = new PerformanceObserver((list, obs, options) => {
for (let entry of list.getEntries()) {
if (!entry.interactionId) continue;
entry.renderTime = entry.startTime + entry.duration;
worstInp = Math.max(entry.duration, worstInp);
console.log('[Interaction]', entry.duration, `type: ${entry.name} interactionCount: ${performance.interactionCount}, worstInp: ${worstInp}`, entry, options);
}
});
observer.observe({
type: 'event',
durationThreshold: 0, // 16 minimum by spec
buffered: true
});
content_copyCOPY
https://web.dev/articles/manually-diagnose-slow-interactions-in-the-lab?hl=en
Comments