| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/ja/docs/Web/API/Performance_API/Performance_data | [Back] [Original] |
Get to know MDN better
API
API Window Worker performance.timeOrigin
API PerformanceEntry entryType
"element" "event" Interaction to Next Paint "first-input" First Input Delay "largest-contentful-paint" "layout-shift" "longtask" 50ms "mark" measure 2 "navigation" "paint" resource "visibility-state" "resource" DNS PerformanceEntry "resource" PerformanceEntry DNS PerformanceResourceTiming
PerformanceEntry PerformanceEntry PerformanceEntry name
PerformanceEntry
LargestContentfulPaintLayoutShiftPerformanceElementTimingPerformanceEventTimingPerformanceLongTaskTimingPerformanceMarkPerformanceMeasurePerformancePaintTimingPerformanceResourceTiming
PerformanceNavigationTiming PerformanceResourceTiming TaskAttributionTimingVisibilityStateEntry2PerformanceObserver observe buffered
function logEventDuration(entries) {
const events = entries.getEntriesByType("event");
for (const event of events) {
console.log(
`Event handler took: ${
event.processingEnd - event.processingStart
} milliseconds`,
);
}
}
const observer = new PerformanceObserver(logEventDuration);
observer.observe({ type: "event", buffered: true });
Performance.getEntries()Performance.getEntriesByName()Performance.getEntriesByType()
const events = performance.getEntriesByType("event");
for (const event of events) {
console.log(
`Event handler took: ${
event.processingEnd - event.processingStart
} milliseconds`,
);
}
PerformanceObserver
getEntries* 2getEntries* entryType |
||
|---|---|---|
"mark" |
PerformanceMark |
Infinite |
"measure" |
PerformanceMeasure |
Infinite |
"navigation" |
PerformanceNavigationTiming |
Infinite |
"resource" |
PerformanceResourceTiming |
250 |
"longtask" |
PerformanceLongTaskTiming |
200 |
"paint" |
PerformancePaintTiming |
2 |
"element" |
PerformanceElementTiming |
150 |
"event" |
PerformanceEventTiming |
150 |
"first-input" |
PerformanceEventTiming |
1 |
"layout-shift" |
LayoutShift |
150 |
"largest-contentful-paint" |
LargestContentfulPaint |
150 |
"visibility-state" |
VisibilityStateEntry |
50 |
"first-input" "paint" 1 2
function perfObserver(list, observer, droppedEntriesCount) {
list.getEntries().forEach((entry) => {
//
});
if (droppedEntriesCount > 0) {
console.warn(
` ${droppedEntriesCount} `,
);
}
}
const observer = new PerformanceObserver(perfObserver);
observer.observe({ type: "resource", buffered: true });
1 PerformanceObserver.takeRecords()
toJSON() JSON
const observer = new PerformanceObserver((list) => {
list.getEntries().forEach((entry) => {
console.log(entry.toJSON());
});
});
observer.observe({ type: "event", buffered: true });
JSON
{
"name": "dragover",
"entryType": "event",
"startTime": 67090751.599999905,
"duration": 128,
"processingStart": 67090751.70000005,
"processingEnd": 67090751.900000095,
"cancelable": true
}
PerformanceEntry JSON.stringify(entry) toJSON()
EventCountsLargestContentfulPaintLayoutShiftLayoutShiftAttributionNotRestoredReasonsNotRestoredReasonDetailsPerformancePerformanceEntryPerformanceElementTimingPerformanceEventTimingPerformanceLongAnimationFrameTimingPerformanceLongTaskTimingPerformanceMarkPerformanceMeasurePerformanceNavigationPerformanceNavigationTimingPerformanceObserverPerformanceObserverEntryListPerformancePaintTimingPerformanceResourceTimingPerformanceScriptTimingPerformanceServerTimingPerformanceTimingTaskAttributionTimingVisibilityStateEntry| Web Proxy Viewer | New URL | Original Page |