( frame: VirtualScrollFrameStats, )
| 57 | } |
| 58 | |
| 59 | export function recordVirtualScrollFrameStats( |
| 60 | frame: VirtualScrollFrameStats, |
| 61 | ): void { |
| 62 | stats.samples += 1 |
| 63 | stats.maxItemCount = Math.max(stats.maxItemCount, frame.itemCount) |
| 64 | stats.maxMountedCount = Math.max(stats.maxMountedCount, frame.mountedCount) |
| 65 | stats.maxMeasuredMountedCount = Math.max( |
| 66 | stats.maxMeasuredMountedCount, |
| 67 | frame.measuredMountedCount, |
| 68 | ) |
| 69 | stats.maxUnmeasuredMountedCount = Math.max( |
| 70 | stats.maxUnmeasuredMountedCount, |
| 71 | frame.unmeasuredMountedCount, |
| 72 | ) |
| 73 | stats.maxHeightCacheSize = Math.max( |
| 74 | stats.maxHeightCacheSize, |
| 75 | frame.heightCacheSize, |
| 76 | ) |
| 77 | stats.maxMountedRefCount = Math.max( |
| 78 | stats.maxMountedRefCount, |
| 79 | frame.mountedRefCount, |
| 80 | ) |
| 81 | stats.maxViewportHeight = Math.max( |
| 82 | stats.maxViewportHeight, |
| 83 | finite(frame.viewportHeight), |
| 84 | ) |
| 85 | stats.maxScrollTop = Math.max(stats.maxScrollTop, finite(frame.scrollTop)) |
| 86 | stats.maxTopSpacer = Math.max(stats.maxTopSpacer, finite(frame.topSpacer)) |
| 87 | stats.maxBottomSpacer = Math.max( |
| 88 | stats.maxBottomSpacer, |
| 89 | finite(frame.bottomSpacer), |
| 90 | ) |
| 91 | stats.maxTotalHeight = Math.max(stats.maxTotalHeight, finite(frame.totalHeight)) |
| 92 | if (frame.isSticky) stats.stickySamples += 1 |
| 93 | if (frame.clampEnabled) stats.clampEnabledSamples += 1 |
| 94 | } |
| 95 | |
| 96 | export function getVirtualScrollStatsSnapshot(): VirtualScrollStatsSnapshot { |
| 97 | return { ...stats } |
no test coverage detected