This commit is contained in:
Ibrahim 2024-10-04 12:16:56 -04:00
parent 478def8447
commit 327f2cb1cf

View File

@ -483,3 +483,20 @@ window.config = {
},
],
};
function waitForElement(selector, maxAttempts = 20, interval = 25) {
return new Promise(resolve => {
let attempts = 0;
const checkForElement = setInterval(() => {
const element = document.querySelector(selector);
if (element || attempts >= maxAttempts) {
clearInterval(checkForElement);
resolve();
}
attempts++;
}, interval);
});
}