()
| 51 | } |
| 52 | |
| 53 | async function waitForContentToStabilize() { |
| 54 | return new Promise((resolve) => { |
| 55 | let timeout; |
| 56 | const observer = new MutationObserver(() => { |
| 57 | clearTimeout(timeout); |
| 58 | timeout = setTimeout(() => { |
| 59 | observer.disconnect(); |
| 60 | console.log('Content has stabilized'); |
| 61 | resolve(); |
| 62 | }, 100); // Adjust this delay as needed |
| 63 | }); |
| 64 | |
| 65 | observer.observe(document.body, { |
| 66 | childList: true, |
| 67 | subtree: true, |
| 68 | attributes: true, |
| 69 | }); |
| 70 | |
| 71 | // Fallback in case the page never stabilizes |
| 72 | setTimeout(() => { |
| 73 | observer.disconnect(); |
| 74 | console.log('Timed out waiting for content to stabilize'); |
| 75 | resolve(); |
| 76 | }, 5000); // Adjust this timeout as needed |
| 77 | }); |
| 78 | } |
| 79 | |
| 80 | |
| 81 |
nothing calls this directly
no outgoing calls
no test coverage detected