Created
July 9, 2025 09:03
-
-
Save piecyk/f0945f58ae8b4382c9983feafcbe9dcc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function waitForTimeout(ms) { | |
| return new Promise(resolve => setTimeout(resolve, ms)); | |
| } | |
| function waitForIdle(timeout = 2000) { | |
| return new Promise(resolve => { | |
| if ('requestIdleCallback' in window) { | |
| requestIdleCallback(resolve, { timeout }); | |
| } else { | |
| setTimeout(resolve, timeout); | |
| } | |
| }); | |
| } | |
| const testList = async (offsetTop) => { | |
| const scrollElement = document.querySelector( | |
| '[aria-label="Grid table scroll wrapper"]' | |
| ); | |
| if (!scrollElement) { | |
| console.warn("Scroll element not found"); | |
| return; | |
| } | |
| console.log("π Found scroll element:", scrollElement); | |
| performance.clearMarks(); | |
| performance.clearMeasures(); | |
| performance.mark("scroll-start"); | |
| console.log("β Marked scroll-start"); | |
| scrollElement.scrollTo({ top: offsetTop }); | |
| console.log("π Scrolling..."); | |
| await waitForTimeout(100); | |
| console.log("β³ waitForTimeout complete"); | |
| await waitForIdle(); | |
| console.log("ποΈ waitForIdle complete"); | |
| performance.mark("scroll-end"); | |
| console.log("β Marked scroll-end"); | |
| performance.measure("scroll", "scroll-start", "scroll-end"); | |
| const data = performance.getEntriesByName("scroll"); | |
| console.log("π Measured scroll performance:", data?.[0].duration); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment